-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththree.js
More file actions
35 lines (24 loc) · 832 Bytes
/
three.js
File metadata and controls
35 lines (24 loc) · 832 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// For of loop
const arr=[1,2,3,4,5]
for (const num of arr) {
console.log(num);
}
const greetings="hello world!"
for (const greet of greetings){
console.log(`Each char is ${greet}`);
}
//Maps -->The Map object holds key-value pairs and remembers the original insertion order of the keys.,
//Map objects are collections of key-value pairs. A key in the Map may only occur once; it is unique in the Map's collection.
//A Map object is iterated by key-value pairs
const map=new Map()
map.set('a',23);
map.set('b',56);
map.set('c',35);
// console.log(map.get('a')); //p/p-->23
// console.log(map.set('a',45)) /// o/p--> 45 , a updated to 45
// console.log(map);
//for of loop on map
for(const [keys,values] of map){
console.log(keys, ':-',values);
}
//**************FOR OF LOOP DOES NOT WORK FOR OBJECTS */