code: function toInteger(val) {
              var v = +val;// toNumber conversion
              
              if(isNaN(v)) {
                  return 0;
              }
              if(v === 0 || v === Infinity || v == -Infinity) {
                  return v;
              }
              if(v < 0) {
                  return -1 * Math.floor(-v);
              } else {
                  return Math.floor(v);
              }
          }
docs: ES5 9.2