Created by levikLinked to 30m issues across 272 teams
You can loop through a JavaScript object using a for...in
loop. This loop will iterate over all the enumerable properties of an object. For example:
const myObject = { name: 'John', age: 25, city: 'New York' }; for (const key in myObject) { console.log(`${key}: ${myObject[key]}`); }
The above code will output the following:
name: John age: 25 city: New York
Contributor
Teams
272