QP School
JavaScript - For...Of Statement Example - Printable Version

+- QP School (https://qomplainerzschool.lima-city.de)
+-- Forum: Tutorials (https://qomplainerzschool.lima-city.de/forumdisplay.php?fid=3)
+--- Forum: JavaScript Tutorials (https://qomplainerzschool.lima-city.de/forumdisplay.php?fid=6)
+--- Thread: JavaScript - For...Of Statement Example (/showthread.php?tid=4096)



JavaScript - For...Of Statement Example - Qomplainerz - 04-04-2023

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>");
  }