The Type Alchemist
Easy+20 XP
Mission Briefing
The Kingdom's census data is corrupted; all citizen ages have been recorded as text instead of math-ready numbers. You need to act as an alchemist and convert them back.
The Concept: Type Conversion
Data types matter! You can't perform math on the string "50" the same way you can on the number 50. Use the Number() function to transform numeric strings into actual numbers.
The Objective
Your function receives a string val that contains numeric characters.
- Convert the
valstring into a proper Number type. - Return the converted number.
01EXAMPLE 1
Input
val = "50"Output
50Constraints
- Result must be a Number type.
FundamentalsData Types
JavaScriptSystem handles I/O — write your function only
Loading...
3 Hidden
Input Arguments
val"50"
Expected Output
50
Click RUN to test your solution