Converting Strings to Numbers in Javascript


Use parseInt() or parseFloat() to convert strings to numbers.

Source Code

let integer = parseInt("10");
let floating = parseFloat("10.5");
console.log(integer); // 10
console.log(floating); // 10.5
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments