$ ./guess_the_languageProblem Solving — predict the output
Problem Solving — predict the output · medium · #170

What is the output?

const arr = [1, 2, 3] as const;
console.log(arr.length);
  1. 3
  2. 0
  3. undefined
  4. Error
as const only narrows the type; the runtime value is an ordinary array.
Play Problem Solving ▸