html
html
1
2
3
4
5
6
7
8
9
10
11
12
<!-- Created for Harmeet Singh Bhatia's question:
https://www.sololearn.com/Discuss/1592339
-->
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
</body>
</html>
Enter to Rename, Shift+Enter to Preview
css
css
1
Enter to Rename, Shift+Enter to Preview
js
js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Created for Harmeet Singh Bhatia's question:
// https://www.sololearn.com/Discuss/1592339
// How do i do a forEach loop for all objects inside an object?
// For example: -
// let options = {}
// options ={
// "object1":{object_data},
// "object2":{object_data},
// "object3":{object_data}
// }
// Now I want to do something like
// options.forEach(option=>{
// ...
// });
let options = { object1: "first", object2: "second" };
Object.keys(options).forEach(
function(key) {
console.log(key+": "+options[key]);
});
Enter to Rename, Shift+Enter to Preview
BROWSER
Console
Run