Javascript ?? vs ||
Found this great article → https://www.trevorlasn.com/blog/javascript-logical-operators
This is a small and useful snippet that makes it very clear on when to use ?? and when to use ||
// Let's see what || considers "falsy":
0 || "default" // returns "default"
"" || "default" // returns "default"
false || "default" // returns "default"
null || "default" // returns "default"
undefined || "default" // returns "default"
// Now compare with ??:
0 ?? "default" // returns 0 ✨
"" ?? "default" // returns "" ✨
false ?? "default" // returns false ✨
null ?? "default" // returns "default"
undefined ?? "default" // returns "default"