I presume the following instantiates, one by one, five instances of the fat arrow function object, one for each time around the loop.
for (const num of [1, 2, 3, 4, 5])
(() => console.log(num))()
How does JavaScript associate these function instances with the for-loop block?
Was it necessary to modify the specification of loops like for
, when block scoping was introduced in ES2015?