QP School

Full Version: JavaScript - For...Of Statement Example
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Code:
const arr = [3, 5, 7];
arr.foo = "hello";

for(const i in arr)
  {
    document.write(i + "<br>");
  }

for(const i of arr)
  {
    document.write(i + "<br>");
  }