Text to Number

EasyAcc. 97.2%
+15 XP 5

Filtering Text

When users type data like weight into a form, they might write "150kg". To do math safely, we need to extract only the numeric part. parseInt() is highly useful to grab a leading whole number from a string.

The Assignment

Your function receives a raw text input named data.

  1. Use parseInt() to convert the data string into a clear integer.
  2. Add a bonus weight of 10 to it.
  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...
5 Hidden

Input Arguments

data"150kg"

Expected Output

160

Click RUN to test your solution