Parse number with unknown

Report a typo

Write a TypeScript function called parseNumber that takes a parameter of type unknown and returns a number if the input is a valid number. If the input is not a number, the function must return NaN.

Sample Input 1:

Sample Output 1:

NaN
5
Write a program in TypeScript
// write your code here
function parseNumber() {

}

Create a free account to access the full topic