Javascript-форум (https://javascript.ru/forum/)
-   Общие вопросы Javascript (https://javascript.ru/forum/misc/)
-   -   Задачка на смекалку (https://javascript.ru/forum/misc/11431-zadachka-na-smekalku.html)

Riim 16.08.2013 12:57

(function() {
    'use strict';
    
    var fn = function() {
            console.log(this);
            console.log(arguments);
        },
        arr = [fn, 1, 2, 3, 4, 5];
    
    Function.prototype.call.apply(
        function() {
            Function.prototype.call.apply(this, arguments);
        },
        arr
    );
})();

Яростный Меч 16.08.2013 14:19

да, правильно.
у меня чуть короче было:
(function() {
    'use strict';
    
    var fn = function() {
            console.log(this);
            console.log(arguments);
        },
        arr = [fn, 1, 2, 3, 4, 5];
    
    Date.call.apply(Date.call, arr);
})();

monolithed 16.08.2013 21:39

Тогда уж:

Function.call.apply(Function.call, arr);


Часовой пояс GMT +3, время: 22:36.