• Clone Arrays in JavaScript

    You can use the following code to clone arrays in JavaScript.

    var arr =  [ 10, 20, 30, 4, 5, 6, 112, 333, 4, 2, 5, 66 ]
    
    var arr2 = arr.slice(0);
    
    console.log('Actual array ', arr);
    console.log('Cloned array', arr2);