+ 1

Why this '+' symbol is not working?

The '/' symbol is working properly but '+' symbol isn't working. When i was writing code, i have done number= num and showing the answer like 1+ 1 = 11 but now i have added number == num it is not showing, it is showing only divide. Please help me: https://code.sololearn.com/WT8Lob2UZuD4/?ref=app

24th Jun 2021, 4:12 AM
🔥🅳🅴🆅 🅼🅸🆂🅷🆁🅰🔥
🔥🅳🅴🆅  🅼🅸🆂🅷🆁🅰🔥 - avatar
2 Answers
+ 1
The first reason is for not working it because in your code you have declared if(symbol= "/") that's why the symbol will become / so that's why your code won't work. You should declare if(symbol=="/") also you should print the answer either in alert or console, not both. The second reason is like @Allan told you.You should parse your input as an int or float to get the accurate answer. After fixing your code,it would be something like this: https://code.sololearn.com/Wa4A14a25A11
24th Jun 2021, 6:44 AM
The future is now thanks to science
The future is now thanks to science - avatar
+ 5
because in javascript '+' is used for string concatenation, to use the sign as a plus symbol you do thd following : 1. write your code in HTML and use &plus then use DOM in javascript to access the attribute in HTML or 2. in your javascript code parse your input as integers since they are treated as strings, convert them to integers first before using them in the + part
24th Jun 2021, 4:41 AM
Allan 🔥STORMER🔥🔥🔥🔥
Allan 🔥STORMER🔥🔥🔥🔥 - avatar