+ 3
Help with code JS
https://code.sololearn.com/W6P02P26P63C/?ref=app var a=prompt("number") var b=prompt("number") var c=a+b console.log(a+"+"+b+"="+c) 1+1=11
4 Respuestas
+ 20
console.log("Console.log v1.0.0")
name=prompt("Your name")
console.log("Hello "+name+"!")
var a=prompt("number")
var b=prompt("number")
var c=a*1+b*1
console.log(a+"+"+b+"="+c)
//prompt returns strings, you have to convert them to numbers to do numeric operations... Number(n), n*1, n/1...
+ 8
@ILYA use parseInt() function when asking for a number i.e. prompt a and b. I have edited your code in my version. See it. And also use ; semicolon in the end of the statements.
https://code.sololearn.com/Wl4Wghz5Cv9e/#html
+ 4
thanks
+ 4
A simple way to solve thus issue, try change to this:
var c=+a+ +b