let, const, and Scope
The answer to the exercise in let, const, and Scope.
|| treats 0 as missing, because 0 is falsy. ?? only falls back on
null and undefined, so the real rating of 0 is kept.
The answer to the exercise in let, const, and Scope.
|| treats 0 as missing, because 0 is falsy. ?? only falls back on
null and undefined, so the real rating of 0 is kept.
const show = { title: "Andor", rating: 0 }; console.log("Rating:", show.rating ?? "not rated"); // was: ||