Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript iterate object

const obj = { 0: 'a', 1: 'b', 2: 'c' };
console.log(Object.entries(obj)); // => [ ['0', 'a'], ['1', 'b'], ['2', 'c'] ]

Object.entries(obj).forEach((key, value) => {
  console.log(key + ' ' + value);
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #iterate #object
ADD COMMENT
Topic
Name
5+6 =