EN
TypeScript - convert string to number
0 points
In this article, we would like to show you how to convert string to number in TypeScript.
xxxxxxxxxx
1
const text: string = '123';
2
3
const number = Number(text);
4
5
console.log(number === 123); // true
xxxxxxxxxx
1
const text: string = '3.13';
2
3
const number = Number(text);
4
5
console.log(number === 3.13); // true