javascript - Mixing named and non named arguments when calling Function.prototype.apply() -


i have function calls other functions without knowing how many arguments need , how named, @ same time pass functions argument, should able access via name.

let's have:

function f1(a, b, c) {     // works on a, b, c }  function f2(d, e) {     // works on d, e }  function caller() {     var args = generateargsarray();     var f = selectfunction();     f.apply(null, args) } 

at point, add arguments argument, let's call mainarg. , i'd love both f1 , f2 able access argument name.

i know can use object instead of array when using apply, if that, need know names of variables each function uses , name them accordingly in object i'm passing apply.

how supposed achieve goal?


Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -