Course · Section 2: JavaScript Fundamentals – Part 1 · Lecture 11: Data Types
Implement `toNumber(str)` returning the numeric value of `str`, or `null` when it is not a valid number.
+ 1 hidden test run on Submit.
Number() does the coercion and Number.isNaN reliably detects the failure case so you can return null instead of NaN.
Run your code to see results.