News for hackers. Stuff that matters.
Re:Ask HN: How to prepare for a Front-end Developer interview? by corecoder on Sunday August 14, 2016 @03:19PM (#12286890)
Before Babel, I often used to ask about code organization/modularization, mostly to filter out candidates who haven't been on a big project and have only copied and pasted jQuery snippets together; today I'd ask if you use Babel modules and why/why not. As other people have said, closures will surely come out. A favorite of mine is array functions: map, forEach, filter. Also, promises, callbacks, workers. Finally, xhr throttling.
Re:Ask HN: How to prepare for a Front-end Developer interview? by grosbisou on Sunday August 14, 2016 @04:43PM (#12287248)
Why would Babel change drastically the way you organize your code? Isn't it a just compiler?
Re:Ask HN: How to prepare for a Front-end Developer interview? by corecoder on Sunday August 14, 2016 @05:01PM (#12287313)
I really meant ES6 modules, I said babel because it's what made ES6 features actually usable in production.
Re:Ask HN: How to prepare for a Front-end Developer interview? by minikomi on Monday August 15, 2016 @12:01AM (#12288572)
Can you clarify what you mean by xhr throttling? Implementing something like _.throttle to wrap requests?
Re:Ask HN: How to prepare for a Front-end Developer interview? by ry_ry on Monday August 15, 2016 @02:40AM (#12289040)
Hopefully not! Surely _.debounce would be more appropriate to avoid locking out your UI - or worse, returning out of date responses - but even then you would potentially want to handle the responses more robustly.

Not to mention needing to handle .fetch()s lack of abort if you're not using xhr.

Re:Ask HN: How to prepare for a Front-end Developer interview? by minikomi on Wednesday August 17, 2016 @09:14PM (#12309794)
How can a throttled vs debounced xhr request "lock out the UI"?
Re:Ask HN: How to prepare for a Front-end Developer interview? by sesm on Sunday August 14, 2016 @04:03PM (#12287082)
Do you mean ES6 modules?
Re:Ask HN: How to prepare for a Front-end Developer interview? by corecoder on Sunday August 14, 2016 @04:59PM (#12287306)
Yes, ES6 modules. Before that I've used browserify, AMD/RequireJS and half assed in-house solutions.
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.