Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

This works in Chrome but not IE, why?

var shell = function (method) {
        window[method].apply(null, Array.prototype.slice.call(arguments, 1));
    };

shell('alert', 'monkey!');
like image 493
shawndumas Avatar asked Jul 06 '10 12:07

shawndumas


1 Answers

alert.apply is the problem. Alert is not part of the language, so it may not be even a function. It is implementation-dependent.

like image 64
25 revs, 4 users 83% Avatar answered Sep 19 '22 17:09

25 revs, 4 users 83%