jiangqr

#1 Created at ... [Delete] [Delete and Lock User]

'use strict';

function string2int(s) {
var length = s.length; var str = [];

while (length-- > 0) {
    str[length] = s[length];
}

var num = str.map( function (x) {
    return x - '0';
});

return num .reduce( function (x, y) {
    return x * 10 + y;
});

}


  • 1

Reply