-1

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

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

without x = +x .

1 Answers1

0

add plus before prompt :

like this :

const x = +prompt("enter your number:");
RenaudC5
  • 3,553
  • 1
  • 11
  • 29
yunes Mohammady
  • 73
  • 2
  • 13