I had a problem where i sa feeding an Function with an array with objects inside.
var func = function (){
var feeded = //here is my problem
/*some code/*
}
var itemArray = [{"stat":49,"amount":156},{"stat":40,"amount":108},{"stat":5,"amount":207},{"stat":7,"amount":311}] //just an exsample
var answare = func(itemArray)
How do i med the variable feeded the same as itemArray, so i can use the methods for arrays on feeded?
I have tried useing:
var feeded = [].slice.call(arguments)
and
var feeded = arguments
I could not use a for loop and then get the stat and amount inside. (i am not needing to close lines as it is not needed in google script
var func = function(feeded) { ... }should work for you, given that you are invoking it withfunc(itemArray). Alternately,var func = function() { var feeded = arguments[0]; ... }, if you really, really hate that parameter there. It would be a different matter if you invokedfunc.apply(this, itemArray), but there is no reason to.func(itemArray), you are only getting a single argument in the function. You don't need to accessargumentsunless you want to handle the syntaxfunc(),func(item),func(item, item)... and notfunc(itemArray).