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.

  1. Convert the data string into an integer.
  2. Add 10 to the result.
  3. Return the final numeric value.

01EXAMPLE 1

Inputdata = "150kg"
Output160

Explanation: parseInt("150kg") is 150, plus 10 is 160.

Constraints

  • Use parseInt().
  • Return the result as a number.
FundamentalsTypesMath
JavaScript
Loading...
9 Hidden

Input Arguments

data"150kg"

Expected Output

160

Click RUN to test your solution