
Originally Posted by
Nile
Wrong magic, to make it work you would do this:
Code:
function concatenate(arguments)
{
var string = "";
for(i = 0; i < arguments.length; i++) // either arguments.length or this.arguments.length
{
string += arguments[i]; // I doubt this works - might work
}
return string;
}
And to call it you would need to make an array:
Code:
alert(concatenate(['Yo, ','I'm connected']));
With your posted code, that would work. Now I can change my code. Thanks, Nile!
Here's the code:
Code:
function concatenate(txt)
{
var string = "";
for(i = 0; i < txt.length; i++)
{
string += " " + txt[i];
}
return string;
}
// Example:
alert(concatenate(['hi','who']);
Then again, you can use this code:
Code:
function concatenate(/* args */)
{
var string = "";
for(x = 0; x < arguments.length; x++)
{
string += " "+arguments[x];
}
return string;
}
// Example:
alert(concatenate('this','should','work'));
I'm very sure this will work.
-magicyte
Bookmarks