Question · JavaScript and TypeScript course · Module 4: Asynchronous JavaScript

for...of vs for...in

What is the difference between for...of and for...in?

Answer options

  • Both work identically
  • for...of only works on arrays, for...in works on everything
  • for...of iterates over iterable values, for...in iterates over object keys
  • for...of iterates over keys, for...in iterates over values

You can check the correct answer by solving this task in the CodeWorlds game.