Which of the following is the correct way to cast a string to a number in TypeScript?
let num: number = <string> "42";
let num: number = "42" as number;
let num: number = Number("42");
let num: number = String("42");
This question is part of this quiz :
TypeScript Functions Quiz