Help!!!!! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Help!!!!!

I always thought *Number* turns string into numbers to calculate Can someone tell me why it returns different? https://code.sololearn.com/WFHhFpU8FKz7/?ref=app

28th May 2019, 10:10 PM
Paulo Omega
Paulo Omega - avatar
2 Answers
+ 3
The issue isn't with the Number function, but rather lines 4, 7, and 13. Because there are no functions in the code, lines 4 and 13 wouldn't work considering they can't return anything anymore (and the keyword is return rather than returns), and <!-- --> is not the comment for JS but rather for HTML which would likely confuse the program
28th May 2019, 10:20 PM
Faisal
Faisal - avatar
+ 1
Faisal thank you for taking the time but I figured it out, the issue is with the Number function because it does not add as en equation but it concatenates the two strings inside, so it joins 1 and 6 and it becomes 16 + 10 = 26. Anyways thank you very much and I appreciate the other tips you gave me. #blessings
28th May 2019, 10:31 PM
Paulo Omega
Paulo Omega - avatar