L
-Lost
I have this generic function (JavaScript newbie here, so don't think I am going to impress
you):
function blah()
{
var container = '';
for(var i = 0; i < arguments.length; i++)
{
container += arguments + '\n';
}
alert(container);
}
Now, if I call this like:
blah('Me', 'Myself', 'I');
I get:
ALERT (you know, the alert dialog)
Me
Myself
I
However, if I call it with an array:
var arr_obj = new Array('Me', 'Myself', 'I');
blah(arr_obj);
I get:
ALERT
Me,Myself,I
I tried checking the type of the arguments object but no matter what is passed, arguments
always has a type of 'object'.
Is there something I am missing as to how to check whether or not I passed it an array or
a normal comma-separated string of values?
Also, forgive me if I am missing some fundamental thing here. Thanks!
-Lost
you):
function blah()
{
var container = '';
for(var i = 0; i < arguments.length; i++)
{
container += arguments + '\n';
}
alert(container);
}
Now, if I call this like:
blah('Me', 'Myself', 'I');
I get:
ALERT (you know, the alert dialog)
Me
Myself
I
However, if I call it with an array:
var arr_obj = new Array('Me', 'Myself', 'I');
blah(arr_obj);
I get:
ALERT
Me,Myself,I
I tried checking the type of the arguments object but no matter what is passed, arguments
always has a type of 'object'.
Is there something I am missing as to how to check whether or not I passed it an array or
a normal comma-separated string of values?
Also, forgive me if I am missing some fundamental thing here. Thanks!
-Lost