What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-09-22 21:04:02
js find all custom window properties
Object.keys(window).filter(x => typeof(window[x]) !== 'function' && Object.entries( Object.getOwnPropertyDescriptor(window, x)).filter(e => ['value', 'writable', 'enumerable', 'configurable'].includes(e[0]) && e[1] ).... Add solution -
Javascript 2021-09-21 06:32:03
foreach key value javascript
myObject ={a:1,b:2,c:3} //es6 Object.entries(myObject).forEach(([key, value]) => { console.log(key , value); // key ,value }); //es7 Object.keys(myObject).forEach(key => { console.log(key , myObject[key]) // key , value }) Add solution -
Javascript 2021-09-14 13:16:03
javascript foreach object
const students = { adam: {age: 20}, kevin: {age: 22}, }; Object.entries(students).forEach(student => { // key: student[0] // value: student[1] console.log(`Student: ${student[0]} is ${student[1].age} years old`); }); /* Output: Student: adam... Add solution -
Javascript 2021-09-14 10:30:02
js object for each
const students = { adam: {age: 20}, kevin: {age: 22}, }; Object.entries(students).forEach(student => { // key: student[0] // value: student[1] console.log(`Student: ${student[0]} is ${student[1].age} years old`); }); /* Output: Student: adam... Add solution