On Mon, Sep 29, 2014 at 4:14 PM, Rick Waldron <[email protected]> wrote:
> Can you clarify "write"? Does this mean assignment?
Yes.
> Why would assignment throw?
Assigning to an uninitialized variable is an error in ES6. A
let-binding is initialized when its declaration is evaluated. So this
is OK:
let x; // no Initializer, so it's initialized to undefined
console.log(x); // logs undefined
but this is not:
init();
let answer;
function init() {
answer = 42; // throws ReferenceError
}
-j
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss