Last active
September 3, 2019 23:01
-
-
Save masautt/66c498235ec24227eb2b63ded69f288c to your computer and use it in GitHub Desktop.
How to loop through an Object in JavaScript?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var obj = { first: "John", last: "Doe" }; | |
Object.keys(obj).forEach(function(key) { | |
console.log(key, obj[key]); // first, John | |
// last, Doe | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment