$ ./guess_the_languageProblem Solving — fix the bug
Problem Solving — fix the bug · easy · #18

Which fix removes the bug?

function getLen(s: string): number {
  return s.length;
}
const n: number = getLen(42);
  1. Change return type to string
  2. Pass a string, e.g. getLen("42")
  3. Change s: string to s: any
  4. Remove the type annotation on n
The argument must be a string to match the parameter type.
Play Problem Solving ▸