What will be the possible output of the following JavaScript code?

var a = [1,2,3,4,5];
a.slice(0,3);

a) Returns [1,2,3]
b) Returns [4,5]
c) Returns [1,2,3,4]
d) Returns [1,2,3,4,5]

               0,1,2

a) Returns [1,2,3]

1 Like

option a - it will return value from index 0 to index 2 [1,2,3]

2 Likes

option “a” retuns[1,2,3]

2 Likes