\n \nS is not working. \nOther operations are working correctly, but addition (var s) is not working. Where did I go wrong? I can't see it. Please help me.","answerCount":1,"upvoteCount":0,"acceptedAnswer":{"@type":"Answer","text":"promt accept input in string farmat..\nAnd addition + operator works as cancatination operation for string.. So you need convert string values to numbers..\nEx:\nvar first= Number(promt(\"enter\")) ;\n\nOr just you can use + as +promt(\"text\") ;","upvoteCount":5},"suggestedAnswer":[]} }
0

Where did I make a mistake??

<script> var first = prompt("Enter an integer","0"); var second = prompt("Enter another integer","0"); var s = first + second; var d = first - second; var m = first * second; var q = first / second; document.write("Toplama işleminin sonucu " + s + "<br />"); document.write("Çıkarma işleminin sonucu " + d + "<br />"); document.write("Çarpma işleminin sonucu " + m + "<br />"); document.write("Bölme işleminin sonucu " + q + "<br />"); </script> S is not working. Other operations are working correctly, but addition (var s) is not working. Where did I go wrong? I can't see it. Please help me.

12th Jul 2020, 11:17 AM
Gülefşan
Gülefşan - avatar
1 Antwort
+ 5
promt accept input in string farmat.. And addition + operator works as cancatination operation for string.. So you need convert string values to numbers.. Ex: var first= Number(promt("enter")) ; Or just you can use + as +promt("text") ;
12th Jul 2020, 11:27 AM
Jayakrishna 🇮🇳