+1 vote
in JavaScript by
Which one of the following options is the correct output for the given code of JavaScript?

vararr=[4,3,2,1];  

var rev=arr.reverse();  

document.writeln(rev);  

a) 1, 2, 3,4

b) 4, 3, 2, 1

c) 3

d) 1

1 Answer

0 votes
by

Answer: B

Reason: The "reverse()" method used in the above given code is one of the predefined methods of the JavaScript, which is used to shift the data elements of an array in a reverse order.

...