I just got stuck on a piece of code in a tutorial I’ve been working on.
It didn’t work when I wrote
for (item in data) {…
but it worked when I noticed that in the tutorial it stated
for (item of data) {…
Can anyone tell me what the difference is? I’ve tried searching online, but I can’t find much about it…
Btw, ‘data’ refers to some data in a SQL database. Not sure if that makes much difference or not… Is for (i of …) something only used when looping over a database?