Skip to content

Comment on ES6 in Depth: Destructuringparent

Comments

    var temp = NaN;
    var wtf = temp[0];
    console.log(wtf); //undefined
What else would you expect it to be? JavaScript in general guards against throwing errors as much as possible... I'd much rather see this behavior in practice than having to put extra try/catch blocks everywhere... Not to mention what this would do to async code.
AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.