← Back to challenges

Array of Strings to Array of Numbers

JavaScriptHardarrayslanguage_fundamentalsstrings

Instructions

Create a function that takes as a parameter an array of "stringified" numbers and returns an array of numbers.

Example:

["1", "3", "3.6"] ➞ [1, 3, 3.6]

Examples

toNumberArray(["9.4", "4.2"]) ➞ [9.4, 4.2]

toNumberArray(["91", "44"]) ➞ [91, 44]

toNumberArray(["9.5", "8.8"]) ➞ [9.5, 8.8]

Notes

Some inputs are floats.

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Circle or Square