const str = "+385(0)21386644";
const toNumb = Number(str)
console.log(toNumb) //NaN
This traditional way is not working :s
How can i convert this string to number?
const str = "+385(0)21386644";
const toNumb = Number(str)
console.log(toNumb) //NaN
This traditional way is not working :s
How can i convert this string to number?
Use String replace , to replace all non numeric characters with ''
, then use Number
const x = Number("+385(0)21386644".replace(/[^0-9]/g, ''));
console.log(typeof x)