im new in this forum so, if i wrong to post this i apologize. Im learnin Javascript and for training i made this bubblesort algorithm:

```
var x = [1, 5, 2, 8, 3, 6, 4, 9, 7]; 

sort(x);

function sort(params) {
  var appoggio=0;
  for (i=0; i<params.length; i++) {
    for (j=0; j<params.length; j++) {
        appoggio=params[j];
        params[j] = params[j+1];
        params[j+1] = appoggio;
    }
  }
}

console.log(x); 

```

I have made a basic html page where i call this script but it doesn't work and i don't understand why. I try to debugg it inser some alert(params[j]) inside the for cycle but after the first interation the scrpt blocks all the web page. What i have to do?