Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

foreach object javascript

const obj = {
  name: 'Jean-Luc Picard',
  rank: 'Captain'
};

// Prints "name Jean-Luc Picard" followed by "rank Captain"
Object.entries(obj).forEach(entry => {
  const [key, value] = entry;
  console.log(key, value);
});
Source by masteringjs.io #
 
PREVIOUS NEXT
Tagged: #foreach #object #javascript
ADD COMMENT
Topic
Name
5+9 =