VIDEO 29 (PART 1) javascript
Fri Nov 01 2024 18:00:55 GMT+0000 (Coordinated Universal Time)
Saved by
@E23CSEU1151
/////////*********** LOOPS FOR ARRAYS IN JS ////////////////
// for of
const arr = [1,3,3,4,5]
for(const n of arr){ // n is just a variable in which array elements is stored
console.log(n); // OUTPUT = 1 3 3 4 5
}
const greet = "hello world"
for(const greetings of greet){ // greetings is just a variable in which array elements is stored
console.log(`the value of greet ${greetings}`);
}
/// Maps (always take different values means no repetation and always print in the order they re saved ) maps are not itterable too
const map = new Map();
map.set('IN', "INDIA");
map.set('FR', "FRANCE");
map.set('US', "UNITED STATES OF AMERICA");
console.log(map);
for(const[key,value] of map){
console.log(key,":->",value)
}// OUTPUT = IN :-> INDIA FR :-> FRANCE US :-> UNITED STATES OF AMERICA
content_copyCOPY
Comments