Numeric Coercion
EasyAcc. 95.6%
+20 XP 5
Explicit Casting
Data from external sensors often arrives as strings. To perform arithmetic, you must explicitly cast them. The Unary Plus (+) is the most efficient way to achieve this.
- Cast
stringAandstringBto numbers using+. - Return their sum.
01EXAMPLE 1
Input
stringA = "10", stringB = "5"Output
15Explanation: String merge creates 105; casting creates 15.
Constraints
- Use the + operator.
- Return a number result.
FundamentalsMathTypes
JavaScriptSystem handles I/O — write your function only
Loading...
9 Hidden
Input Arguments
stringA"10"
stringB"5"
Expected Output
15
Click RUN to test your solution