Iterating an Object with Standard For/While
This lesson delves further into looping over an object's property names and values with a traditional for or while loop.
We'll cover the following
For loop
You can also loop with the standard for
loop. Using an index works as well for an array, but again, it won’t let you loop an object without using object.keys()
or object.entries()
which both returns an array. Note that the entries
function requires a library called es2017.object
which must be set in the TypeScript compiler.
Get hands-on with 1400+ tech skills courses.