News for hackers. Stuff that matters.
Re:Ask HN: How to prepare for a Front-end Developer interview? by smnplk on Sunday August 14, 2016 @10:47PM (#12288355)
are JS closures already fixed ?

var a = 10; var fn = function (x) { return x + a}; fn(10); ==> 20 var a = 1; fn(10) ==> 11 //WAT ??

Is the above fixed with ES2015 ? Closures need to enclose values and not references.

Re:Ask HN: How to prepare for a Front-end Developer interview? by corecoder on Monday August 15, 2016 @03:00AM (#12289098)
I don't think javascript will ever be "fixed": it is as it is, if you change how hoisting works, you break everything. But:

1. You can solve that already in ES6, by returning fn from a function, also avoiding the global variable;

2. Your ES3 linter should warn you about the redefined variable.