如何在 TypeScript 中將字符串轉換爲數字? - How to convert a string to number in TypeScript?

問題:

Given a string representation of a number, how can I convert it to number type in TypeScript?給定數字的字符串表示形式,如何將其轉換爲 TypeScript 中的number類型?

var numberString: string = "1234";
var numberValue: number = /* what should I do with `numberString`? */;

解決方案:

參考一: https://en.stackoom.com/question/zXk1
參考二: https://stackoom.com/question/zXk1
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章