Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript iterate through an object (key, value)

const obj = { foo: 'bar', baz: 42 };
Object.entries(obj).forEach(([key, value]) => console.log(`${key}: ${value}`)); // "foo: bar", "baz: 42"
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #javascript #iterate #object
ADD COMMENT
Topic
Name
7+8 =