-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
32 lines (22 loc) · 828 Bytes
/
Copy pathtest.js
File metadata and controls
32 lines (22 loc) · 828 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
// const colors = ['red', 'green', 'blue']; //for of loop
// for (const color of colors) {
// console.log(color);
// }
const persons = { name: "John", age: 30 }; //for in loop
for (const key in persons) {
console.log(key + ": " + persons[key]);
}
// const persons = { name: "John", age: 30 }; //for in loop
// foreach (key) {
// console.log(key + ": " + persons[key]);
// }
// let array= ['rahul',42,'rohan','toni stak']
// array.forEach(function(currentValue, index, array) {
// // code to execute for each element
// console.log(index)
// });
// let str= 'mohan is doctor'
// const newStr=str.split('').reverse().join('')
// console.log(newStr) //output =rotcod si nahom
// const newStr=str.split(' ').reverse().join(' ')
// console.log(newStr) //output =doctor is mohan