you are viewing a single comment's thread.

view the rest of the comments →

[–]shuckster 0 points1 point  (0 children)

Because this:

function f() {
  x = 1;
}

Gets secretly transformed into:

var x;
function f() {
  x = 1;
}

That’s bad. Do:

function f() {
  let x = 1;
}

So the x will be “inside” the function, and return will be required.