$ ./guess_the_languageProblem Solving — fix the bug
Problem Solving — fix the bug · easy · #19

What is the correct fix?

const obj = { a: 1, b: 2 };
for (const key in obj) {
  console.log(obj.key);
}
  1. Change in to of
  2. Use Object.values(obj)
  3. Change obj.key to obj[key]
  4. Change const key to let key
Dynamic property access needs bracket notation obj[key].
Play Problem Solving ▸