The easiest way to convert the type of this string to a number?
var x = prompt("enter your number:");
without x = +x .
The easiest way to convert the type of this string to a number?
var x = prompt("enter your number:");
without x = +x .
add plus before prompt :
like this :
const x = +prompt("enter your number:");