Skip to content

Commit e14b51c

Browse files
committed
day 6
1 parent 371ab16 commit e14b51c

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

‎06_Day/06_day_loops.md‎

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ for(let i = 0; i < numbers.length; i++){
6060
console.log(sum) // 15
6161
```
6262

63-
Creating a new are based on the existing array
63+
Creating a new array based on the existing array
6464

6565
```js
6666
const numbers = [1, 2, 3, 4, 5]
@@ -74,6 +74,16 @@ for(let i = 0; i < numbers.length; i++){
7474
console.log(newArr) // [1, 4, 9, 16, 25]
7575
```
7676

77+
```js
78+
const countries = ['Finland', 'Sweden', 'Norway', 'Denmark', 'Iceland']
79+
const newArr = []
80+
for(let i = 0; i < countries.length; i++){
81+
newArr.push(countries[i].toUpperCase())
82+
}
83+
84+
console.log(newArr) // ["FINLAND", "SWEDEN", "NORWAY", "DENMARK", "ICELAND"]
85+
```
86+
7787
### while loop
7888

7989
```js
@@ -145,6 +155,16 @@ for (const tech of webTechs) {
145155

146156
```
147157

158+
```js
159+
const countries = ['Finland', 'Sweden', 'Norway', 'Denmark', 'Iceland']
160+
const newArr = []
161+
for(const country of countries){
162+
newArr.push(country.toUpperCase())
163+
}
164+
165+
console.log(newArr) // ["FINLAND", "SWEDEN", "NORWAY", "DENMARK", "ICELAND"]
166+
```
167+
148168
### break
149169

150170
content will be added soon

0 commit comments

Comments
 (0)