js字符串转换成数字 将字符串转换成数字,得用到parseInt函数。 parseInt(string) : 函数从string的开始解析,返回一个整数。 举例: parseInt('123') : 返回 123(int); parseInt('1234xxx') : 返回 1234(int);