* Update README.zh-tw.md

* Update README.zh-tw.md

* Update README.zh-tw.md

* Update README.zh-tw.md

* Update README.de.md

* Update README.es.md

* Update README.zh-cn.md

* Update README.hi.md

* Update README.hi.md

* Update README.id.md

* Update README.it.md

* Update README.it.md

* Update README.ja.md

* Update README.ko.md

* Update assignment.ko.md

* Update README.ko.md

* Update README.ko.md

* Update README.ms.md

* Update README.pt.md

* Update README.de.md

* Update README.md

* Update README.de.md
This commit is contained in:
Flex Zhong
2021-09-06 10:02:40 +08:00
committed by GitHub
parent 4f0994f600
commit 4c1788eefb
14 changed files with 143 additions and 94 deletions

View File

@@ -21,11 +21,15 @@ Working with data is a common task for any language, and it's a much easier task
The syntax for an array is a pair of square brackets.
`let myArray = [];`
```javascript
let myArray = [];
```
This is an empty array, but arrays can be declared already populated with data. Multiple values in an array are separated by a comma.
`let iceCreamFlavors = ["Chocolate", "Strawberry", "Vanilla", "Pistachio", "Rocky Road"];`
```javascript
let iceCreamFlavors = ["Chocolate", "Strawberry", "Vanilla", "Pistachio", "Rocky Road"];
```
The array values are assigned a unique value called the **index**, a whole number that is assigned based on its distance from the beginning of the array. In the example above, the string value "Chocolate" has an index of 0, and the index of "Rocky Road" is 4. Use the index with square brackets to retrieve, change, or insert array values.
@@ -71,10 +75,10 @@ The `for` loop requires 3 parts to iterate:
- `iteration-expression` Runs at the end of each iteration, typically used to change the counter value
```javascript
//Counting up to 10
for (let i = 0; i < 10; i++) {
console.log(i);
}
// Counting up to 10
for (let i = 0; i < 10; i++) {
console.log(i);
}
```
✅ Run this code in a browser console. What happens when you make small changes to the counter, condition, or iteration expression? Can you make it run backwards, creating a countdown?