News for hackers. Stuff that matters.
Re:Is your JavaScript function actually pure? by ohitsdom on Tuesday September 20, 2016 @08:54AM (#12539100)
For those of you that write in JS (and not TypeScript), do you use "void 0" instead of "undefined"? I use undefined and would hate to switch to void 0, since it's less clear and unnecessary thanks to tools like JSHint.
Re:Is your JavaScript function actually pure? by pygy_ on Tuesday September 20, 2016 @09:20AM (#12539277)
`undefined` is a variable that can (could? It may have changed with strict mode or ES6) be set globally to arbitrary values.

You can use `undefined` safely with an IIFE wrapper:

    (function(undefined) {
        // you're safe here
    }());
Re:Is your JavaScript function actually pure? by v413 on Tuesday September 20, 2016 @01:20PM (#12541189)
Prior to ES5 undefined was overwritable that is why void 0 guaranteed to produce undefined. With ES5 and later using undefined directly is safe.