What does this program print?

from Type narrowing
TypeScript 6 beginner 3 min

What does this program print?

TypeScript
function label(value: string | number | null): string {
  if (!value) return "missing";
  return typeof value === "string"
    ? value.toUpperCase()
    : value.toFixed(0);
}

console.log(label(0));
console.log(label(""));
console.log(label(2.6));
Open in playground
Report an error