Friday, June 5, 2015

IE8 not support Object.keys(), how to fix


Only need add this method  to your sourcecode.
Object.keys = Object.keys || function(
    o, // object
    k, // key
    r  // result array
) {
    // initialize object and result
    r = [];
    // iterate over object keys
    for (k in o)
        // fill result array with non-prototypical keys
        r.hasOwnProperty.call(o, k) && r.push(k);
    // return result
    return r;
};
Cheers!

No comments:

Post a Comment