how to convert a String to a Number in JavaScript
8/2/2022, 3:56:04 PM
by Leo Voon
The unary plus operator (+) will convert a string into a number. The operator will go before the operand.
let string = "2"
let number = +string
console.log(number)
// 2