Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js for in object

var obj = { foo: 'bar', baz: 42 };
console.log(Object.entries(obj)); // [ ['foo', 'bar'], ['baz', 42] ]

for(const [i, val] of Object.entries(obj))
	new_obj[i] = val;
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #js #object
ADD COMMENT
Topic
Name
9+3 =