javascript - In der Map-Implementierung in js, var len = O.length >>> 0;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | <code> if (!Array.prototype.map) {
Array.prototype.map = function (callback, thisArg) {
var T, A, k;
if (this == null) {
throw new TypeError( " this is null or not defined" );
}
var O = Object(this);
var len = O.length >>> 0;
if (Object.prototype.toString.call(callback) != "[object Function]" ) {
throw new TypeError(callback + " is not a function" );
}
if (thisArg) {
T = thisArg;
}
A = new Array(len);
k = 0;
while (k < len) {
var kValue, mappedValue;
if (k in O) {
kValue = O[ k ];
mappedValue = callback.call(T, kValue, k, O);
A[ k ] = mappedValue;
}
k++;
}
return A;
};
}</code>
|
var len = O.length >>> Was ist der Zweck der Bitoperatoren hier?