code: function(callback, ctx){
        var k = 0;
  
        // 1. Let O be the result of calling ToObject passing the |this| value as the argument.
        var O = Object(this);
  
        var len = O.length >>> 0; 
  
        if ( typeof callback !== "function" ) {
          throw new TypeError( callback + " is not a function" );
        }
  
        // 7. Repeat, while k < len
        while( k < len ) {
  
          var kValue;
  
          if ( k in O ) {
  
            kValue = O[ k ];
  
            callback.call( ctx, kValue, k, O );
          }
          k++;
        }
      }
docs: polyfill from MDN https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach