Converting an array to a function arguments list [duplicate]

Yes. In current versions of JS you can use:

app[func]( ...args );

Users of ES5 and older will need to use the .apply() method:

app[func].apply( this, args );

Read up on these methods at MDN:

  • .apply()
  • spread “…” operator (not to be confused with the related rest “…” parameters operator: it’s good to read up on both!)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)