4 ms·
console.assert(maybeNull != null, 'variable not set')
by fainpul 11mo ago
console.assert(maybeNull != null, 'variable not set')
- deleted 11mo ago[deleted]
- kbolino 11mo agoFair, this is a good example of when != is actually the right choice (instead of !==). However, on web browsers, this will log an assertion failure to the console, but it will not throw an exception. It's also not suitable for the original context, where the non-null value was extracted into a variable.