Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e14b51c

Browse filesBrowse files
committed
day 6
1 parent 371ab16 commit e14b51c
Copy full SHA for e14b51c

1 file changed

+21-1Lines changed: 21 additions & 1 deletion

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎06_Day/06_day_loops.md‎

Copy file name to clipboardExpand all lines: 06_Day/06_day_loops.md
+21-1Lines changed: 21 additions & 1 deletion
  • Display the source diff
  • Display the rich diff
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.