Skip to content

Latest commit

 

History

History
28 lines (24 loc) · 525 Bytes

copy-with-X-part-2.md

File metadata and controls

28 lines (24 loc) · 525 Bytes

Part2

Complete the function below to change the value of bottom right corner element to 'X'.

Note: The change made should not affect the original array.

function bottomRightElementToX(arr) {
    //write your code here.
}

let orig1 = [
    [5, 2, 4],
    [4, 1, 7],
    [7, 12, 2]
]
let copy1 = bottomRightElementToX(orig1);
console.log(copy1);
console.log(orig1);

let orig2 = [
    [1, 2, 3, 4],
    [4, 5],
    [7, 8, 9]
]
let copy2 = bottomRightElementToX(orig2);
console.log(copy2);
console.log(orig2);