javascript loop nested object
function nestedLoop(obj) {
const res = {};
function recurse(obj, current) {
for (const key in obj) {
let value = obj[key];
if(value != undefined) {
if (value && typeof value === 'object') {
recurse(value, key);
} else {
// Do your stuff here to var value
res[key] = value;
}
}
}
}
recurse(obj);
return res;
}
Also in JavaScript:
- angular how to copy text with button
- how to remove duplicate array object in javascript
- javascript 1 line if
- how to add up all numbers in an array
- material.preactjs type = date use
- como criar uma modal jquery
- freecodecamp cdn
- jquery create input hidden
- javascript reserved words
- Javascript string compression
- fs.writefile
- javascript go to top of page
- change the position of div using javascript
- react-google-maps satelite
- vuejs take rgba values from coordinate
- factorial in javascript using for loop
- node js class
- insert element after element javascript
- javascript add day to date
- extract data from pdf nodejs
- jquery use variable in string
- array map order by timestamp reactjs
- calculator jquery
- Selectores de jQuery CSS básicos