Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

The one-liner code that concatenates all strings passed into a function is ____________

a) function concatenate()
{
return String.prototype.concat(”, arguments);
}
b) function concatenate()
{
return String.prototype.apply(”, arguments);
}
c) function concatenate()
{
return String.concat.apply(”, arguments);
}
d) function concatenate()
{
return String.prototype.concat.apply(”, arguments);
}

Answer: d
Explanation: The concat() method is used to merge two or more arrays. This method does not change the existing arrays, but instead returns a new array. apply takes an array of arguments and treats each element of that array as a single argument.

Join The Discussion