Question

Consider the following code:     let data = [1, 2, 3];     function modifyArray(arr) {         arr.push(4);         arr = [5, 6]; // Reassigns local 'arr'         return arr;     }     let result = modifyArray(data);     console.log(data);     console.log(result);     What will be the output?

A [1, 2, 3] and [5, 6]
B [1, 2, 3, 4] and [5, 6]
C [1, 2, 3, 4] and [1, 2, 3, 4]
D [5, 6] and [5, 6]
E [1, 2, 3] and [1, 2, 3, 4]
Practice Next

Hey! Ask a query