function str2int (s){
return Array.prototype.map.call(s, x => x - 0).reduce((x,y) => x * 10 + y)
}
function str2int2 (s) {
return s.split().reduce((x,y) => x * 10 + y/1,0)
}
function str2int3 (s) {
return [].reduce.call(s,(x,y) => x * 10 + y/1,0)
}
console.log(str2int("10"));
console.log(str2int2("100"));
console.log(str2int3("10"));