function toInteger(n) {
    n = +n;
    if (n !== n) { // isNaN
        n = 0;
    } else if (n !== 0 && n !== (1/0) && n !== -(1/0)) {
        n = (n > 0 || -1) * Math.floor(Math.abs(n));
    }
    return n;
}
Get the substring of a string
 @param  {integer}  start   where to start the substring
 @param  {integer}  length  how many characters to return
 @return {string}