Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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