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 arr=[1,2,3];
var rev=arr.reverse();
document.writeln(rev);

What will be the output of the following JavaScript code?
var arr=[1,2,3];
var rev=arr.reverse();
document.writeln(rev);
a) 1, 2, 3
b) 3, 2, 1
c) 3
d) 1

Answer: b
Explanation: reverse function is a predefined function in array library in Javascript. The function is used to reverse the element of the array.
i.e. 3, 2, 1.

Join The Discussion