Javascript Object Iterate over Objects

Description

Javascript Object Iterate over Objects



// Lets create an object with a few properties
let myNewObject = { property1:213, property2: true, property3: "Hello World"};

// And now we iterate over the members of the object
// "key" is the property name, and myNewObject[key] is the value
for (key in myNewObject) {
  console.log("myNewObject." + key + ": " + myNewObject[key] );
}



PreviousNext

Related