Convertin the typeof string to number

The easiest way to convert the type of this string to a number?

var x = prompt("enter your number:");

without x = +x .

>Solution :

add plus before prompt :

like this : var x = +prompt("enter your number:");

Leave a Reply