i write this code for shuffle array:
function shuffle(arr) {
    for (i = 0; i < arr.length; i++) {
        x = Math.floor(Math.random() * arr.length);
        y = Math.floor(Math.random() * arr.length);
        if (x === y) { //for dont change arr[i] with arr[i]!!!
            continue;
        }
        temp0 = arr[x];
        arr[x] = arr[y];
        arr[y] = temp0;
    }
    return arr
}
it work correctly. but my problem is, this function not global, i explain it with a example:
    sampleArray=["a", "b", "c", "d"];
    shuffle(sampleArray); //only run function
    console.log (sampleArray); // output NOT shuffled. ==>> ["a", "b", "c", "d"]
    console.log (shuffle(sampleArray)); //output shuffled. my be ["d", "a", "c", "b"] or ...
in main code i cant declare sampleArray nested in shuffle function...
 
     
    