but i don’t understand why within a function this does not work:
index = addToPalette(arguments.slice(2,5));
while this does:
index = addToPalette(arguments, arguments, arguments);
the first line give me the error that arguments.slice is not a
function, which is weird, no ?
isn’t the arguments property an array (so that I can call the ‘slice’
method on it ??)
"The mystery of the world is the visible, not the invisible"
the second line should be:
index = addToPalette([arguments, arguments, arguments]);
(not the extra square brackets)
On Apr 20, 2006, at 4:16 PM, Joost Rekveld wrote:
> the first line give me the error that arguments.slice is not a
> function, which is weird, no ?
> isn’t the arguments property an array (so that I can call the
> ‘slice’ method on it ??)
The arguments object is technically *not* an array, despite being
indexable as one. Note the wording "array-like" in the Core
This is why we’ve provided the arrayfromargs utility method which
converts an arguments object to a true array. Basically it does the
following, though from C:
var myarray = new Array();
myarray[i] = args[i];
thanks, now I get it..
Log in to reply
SUBSCRIBE TO OUR NEWSLETTER
C74 RSS Feed | © Copyright Cycling '74 | Terms & Conditions