Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

How to loop through an object in JavaScript with the Object.keys() method

const population = {
  male: 4,
  female: 93,
  others: 10
};

let genders = Object.keys(population);

console.log(genders); // ["male","female","others"]
Source by www.freecodecamp.org #
 
PREVIOUS NEXT
Tagged: #How #loop #object #JavaScript #method
ADD COMMENT
Topic
Name
3+7 =