javascript anonymous function add arguments dynamic -


i hava question javascript anonymous function.

the origin function:

!function (n) {     return n[0].call(1, 2,3); }  ([function (n, t, i) {alert(1);}, function (t) {} ]); 

my problem how add new function dynamicly anonymous function ' arguments this

!function (n) {     return n[0].call(1, 2,3); }  ([function (n, t, i) {alert(1);}, function (t) {},function (t) {alert('new function');}  ]); 

if asking how dynamically add function array of functions:

function f(n) {     return n[2].call(1, 2,3);  }    var functionarray=[    function (n, t, i) {alert(i);},     function (t) {}    ];        var fnew= function (t) {alert('new function');}    functionarray.push(fnew)    f(functionarray);


Comments

Popular posts from this blog

javascript - Confirm a form & display message if form is valid with JQuery -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -