可以使用Number()函数将字符串转换为数字。参考代码如下:const str = "123"; const num = Number(str); console.log(JSON.stringify(num)); // 输出123
可以使用Number()函数将字符串转换为数字。参考代码如下: