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.

What will be the output of the following JavaScript code?
var val1=[1,2,3];
var val2=[6,7,8];
var result=val1.concat(val2);
document.writeln(result);

What will be the output of the following JavaScript code?
var val1=[1,2,3];
var val2=[6,7,8];
var result=val1.concat(val2);
document.writeln(result);
a) 1, 2, 3
b) error
c) 1, 2, 3, 6, 7, 8
d) 123

Answer: c
Explanation: concat is a predefined function in the array library in Javascript. The concat function is used to combine the value of two arrays.
i.e.1, 2, 3, 6, 7, 8

Join The Discussion