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.
[ Parent
| on HN ]
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
}());