I can't get the 2 inputs to add as floats and not as strings. Help plzz🙄 | Sololearn: Learn to code for FREE!
0

I can't get the 2 inputs to add as floats and not as strings. Help plzz🙄

https://code.sololearn.com/W0UXhWW8E1xy/?ref=app

24th Nov 2020, 8:19 PM
Sildi Shaulli
Sildi Shaulli - avatar
4 odpowiedzi
+ 5
Because value attribute is a string. You need to convert from string to number. Edit: https://www.sololearn.com/Discuss/2500838/?ref=app
24th Nov 2020, 8:34 PM
Kevin ★
+ 2
You can use Number(value) to convert a string to a number. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number c = Number(a) + Number(b)
24th Nov 2020, 8:37 PM
ODLNT
ODLNT - avatar
+ 1
Yes but how tho
24th Nov 2020, 8:35 PM
Sildi Shaulli
Sildi Shaulli - avatar
+ 1
Thanks man! I really appreciate it
24th Nov 2020, 8:39 PM
Sildi Shaulli
Sildi Shaulli - avatar