If some one can tell me what the mistake is,it will only show the unsorted array but not the sorted array please help
heres the code:


<HTML>
<HEAD>
<TITLE>
bubblesort
</TITLE>
<SCRIPT language = "JavaScript">


var bubblesort=function(array){
if(arguments.length===0||!Array.isArray(array)){
throw new Error();
}
var hadhaschange;
for(var i=1; i<array.length-1;i++){
hadhaschange=false;

for(var j=0;j<array.length-1;j++){
if(array[j]> array[j+1])
{
hadhaschange=true;
var temp=array[j];
array[j]=array[j+1];
array[j+1]=temp;
}
}
if(!hashadchange){
return array;
}
}
return array;
}
function bubbleTest()
{
var unsortedArray;
var sortedArray;

// array to be ordered
unsortedArray = [9,7,2,10,1,4,8,6,5,3];

document.write('Unsorted Array: ' + unsortedArray + '<BR>');

document.write('Sorted Array: ' + bubblesort(unsortedArray));
}

// invoke bubbleTest() to test function bubblesort()
bubbleTest();



</SCRIPT>
</HEAD>
<BODY>

</BODY>
</HTML>