I have a code for bubble sort:
      var ani = []
export const Bubblesort =(arr) =>{
    for(var i = 0; i < arr.length; i++){
     
        // Last i elements are already in place  
        for(var j = 0; j < ( arr.length - i -1 ); j++){
            
          // Checking if the item at present iteration 
          // is greater than the next iteration
          if(arr[j] > arr[j+1]){
            // If the condition is true then swap them
            var temp = arr[j]
            arr[j] = arr[j + 1]
            arr[j+1] = temp
          }
          console.log (arr)
        }
      }
      // Print the sorted array
      return arr
}
Here I want to get all the position of the elements in array when I print the array, it shows me multiple array in my console. Like it should, but when I make it group of arrays, all the group array are having same number.
Replacing this
console.log (arr)
to this
 ani.push(arr)
 console.log(arr)
this gives me wrong output. Please help.....


 
    