What will be the output of the following JS 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

the reverse arr is b) 3,2,1

3 Likes

option - b rev = [3,2,1]

2 Likes