不使用Number或parseInt将字符串转换为数字

function str2int (){
return Array.prototype.map.call(s, x => x - 0).reduce((x,y) => x * 10 + y)
}

猜你喜欢

转载自blog.csdn.net/qaqLjj/article/details/84147301