|
|
|
|
|
by andai
929 days ago
|
|
Yes! Exactly. However: "use strict";
let undef;
let str1 = "hello";
let str2 = str1 + undef;
console.log(str2); // -> "helloundefined"
Whereas I propose: "use sane";
let undef;
let str1 = "hello";
let str2 = str1 + undef; // -> Uncaught TypeError: Cannot append string and undefined
console.log(str2); // (code never reaches this point)
(I would also settle for "Uncaught ReferenceError: Attempted use of `undef` before initialization.") |
|
You might enjoy this classic comedy routine: https://www.destroyallsoftware.com/talks/wat