Can I pass an array as parameters/arguments in a function?
For example, this works:
key(0, arrowRight, 'regX', anchorLast, 8, 'quartInOut', 175);
This, however, doesn't:
var banana = [0, arrowRight, 'regX', anchorLast, 8, 'quartInOut', 175]
key(banana);
returning Uncaught TypeError: Cannot read property 'x' of undefined
from within the key()
function. What's undefined
here is what should have been arrowRight
(an object).
I've tried searching for answers, and most prescribe the use of .apply()
(or .call()
), but I'm not sure how to apply this to my situation. I'm not even if it's the same problem (still a Javascript beginner).
I didn't post the key()
function here, because I don't think it's relevant.