Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

for in object javascript

var obj = { foo: 'bar', baz: 42 };

Object.keys(obj).forEach((key) => {
    const el = obj[key];
    console.log(
      {
        key: key,
        value: el
      }
    );
});
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #object #javascript
ADD COMMENT
Topic
Name
7+2 =