Three different ways to loop through JavaScript objects

Javascript Jeep🚙💨
Level Up Coding
Published in
2 min readJul 22, 2019

--

Learn how to loop through objects in Javascript.

var object = {  name : "Javascript Jeep",  status : "😎",  icons : "🚗"}

Using for..in

With ES6, we can use Object.entries to loop through each entry of the object. The Object.entries method returns an array of [key, value].

We can also use Object.keys which will return an array filled with keys of the object. Using that array we can loop through the object.

If you know some other ways to loop through object leave a comment.

If you find this helpful surprise 🎁 me here.

Share if you feel happy 😃 😆 🙂 .

Follow Javascript Jeep🚙 if you feel worthy.

--

--