Iterating an object’s keys with for-in #

The first way is to iterate the key of an object. Looping the key is the role of the for-in loop. You can use for-in on a normal array. The result is a list of indices which would be the sequential order of each element. On an object, you will iterate all members’ names.

Get hands-on with 1400+ tech skills courses.