Integer Extraction
EasyAcc. 97.2%
+15 XP 5
Debris Salvage
You are reclaiming scrap metal. The sensors return weights as text like "150kg". You must extract the pure integer to calculate total mass.
parseInt() extracts the leading numeric value from a string.
- Convert the
datastring into an integer. - Add 10 to the result.
- Return the final numeric value.
01EXAMPLE 1
Input
data = "150kg"Output
160Explanation: parseInt("150kg") is 150, plus 10 is 160.
Constraints
- Use parseInt().
- Return the result as a number.
FundamentalsTypesMath
JavaScriptSystem handles I/O — write your function only
Loading...
9 Hidden
Input Arguments
data"150kg"
Expected Output
160
Click RUN to test your solution