Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

JavaScript object iterate

const obj = {
    kiwi: true,
    mango: false,
    pineapple: 500
};

Object.entries(obj).forEach(([k, v], i) => {
    console.log(k, v, i);
});

// kiwi true 0
// mango false 1
// pineapple 500 2
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #JavaScript #object #iterate
ADD COMMENT
Topic
Name
4+4 =