+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.

Related questions

0 votes
asked Mar 22, 2021 in JavaScript by Robindeniel
0 votes
asked Mar 24, 2021 in JavaScript by sharadyadav1986
...