0

What's wrong in this code?

Addition became concatenation https://code.sololearn.com/WiPC6QU1FcWA/?ref=app

19th Oct 2018, 7:34 PM
Thức Đinh
Thức Đinh - avatar
5 Answers
+ 1
the return type of window.prompt it a string, that mean you should cast the value given to Number: var a = Number(prompt("Enter first number:")); var b = Number(prompt("Enter second number:"));
19th Oct 2018, 8:11 PM
MO ELomari
MO ELomari - avatar
+ 4
Mohamed ELomari Seeing your problem was already resolved it would be great if you can mark the answer that you find useful to encourage the community to help each other out. 😉
20th Oct 2018, 12:22 AM
Zephyr Koo
Zephyr Koo - avatar
+ 1
Thank you for help. Casting Number worked correctly
19th Oct 2018, 8:24 PM
Thức Đinh
Thức Đinh - avatar
0
use the '\n' for the newline character
19th Oct 2018, 8:51 PM
MO ELomari
MO ELomari - avatar
0
Thanks. I have to use "<br />" instead
19th Oct 2018, 10:13 PM
Thức Đinh
Thức Đinh - avatar