Skip to content

Commit e8765bd

Browse files
authored
array items using index examples fix
1 parent d16e822 commit e8765bd

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

05_Day/05_day_arrays.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ let lastFruit = fruits[3]
165165
console.log(lastFruit) // lemon
166166
// Last index can be calculated as follows
167167

168-
let lastIndex = len(fruits) - 1
168+
let lastIndex = fruits.length - 1
169169
lastFruit = fruits[lastIndex]
170170
console.log(lastFruit) // lemon
171171
```
@@ -179,7 +179,7 @@ console.log(numbers[0]) // -> 0
179179
console.log(numbers[5]) // -> 100
180180

181181
let lastIndex = numbers.length - 1;
182-
console.log(numbers[lastIndex]) -> 100
182+
console.log(numbers[lastIndex]) // -> 100
183183
```
184184

185185
```js
@@ -199,7 +199,7 @@ console.log(webTechs[0]) // -> HTML
199199
console.log(webTechs[6]) // -> MongoDB
200200

201201
let lastIndex = webTechs.length - 1
202-
console.log(webTechs[lastIndex]) -> MongoDB
202+
console.log(webTechs[lastIndex]) // -> MongoDB
203203
```
204204

205205
```js
@@ -222,7 +222,7 @@ console.log(countries[0]) // -> Albania
222222
console.log(countries[10]) // -> Kenya
223223

224224
let lastIndex = countries.length - 1;
225-
console.log(countries[lastIndex]) -> // Kenya
225+
console.log(countries[lastIndex]) // -> Kenya
226226
```
227227

228228
```js
@@ -242,7 +242,7 @@ console.log(shoppingCart[0]) // -> Milk
242242
console.log(shoppingCart[7]) // -> Sugar
243243

244244
let lastIndex = shoppingCart.length - 1;
245-
console.log(shoppingCart[lastIndex]) -> // Sugar
245+
console.log(shoppingCart[lastIndex]) // -> Sugar
246246
```
247247

248248
### Modifying array element
@@ -721,4 +721,4 @@ const webTechs = [
721721
722722
🎉 CONGRATULATIONS ! 🎉
723723
724-
[<< Day 4](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/04_Day/04_day_conditionals.md) | [Day 6 >>](#)
724+
[<< Day 4](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/04_Day/04_day_conditionals.md) | [Day 6 >>](#)

0 commit comments

Comments
 (0)