JavaScript tip: You might not need an if statement or a ternary


JavaScript tip: You might not need an if statement or a ternary.

JS has Nullish coalescing assignment.

Example: user.age ??= 'unknown age';

More: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing_assignment

#javascript

View original on X