Javascript - Looping with for...in
Code Life
By Pierre Marsaa
Looping Over the Keys
Arrays have for...of to visit every value. Objects have for...in, which visits every key:
↗️
Loading editor...
↶
↷
At each turn, key holds the name of a property, as a string: "hp", then "attack", then "speed".
Loading editor...
Verify