You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
functionbubbleSort(arr){vari,j;varlen=arr.length;varisSwapped=false;for(i=0;i<len;i++){isSwapped=false;for(j=0;j<len;j++){if(arr[j]>arr[j+1]){vartemp=arr[j]arr[j]=arr[j+1];arr[j+1]=temp;isSwapped=true;}}// IF no two elements were swapped by inner loop, then breakif(!isSwapped){break;}}// Print the arrayconsole.log(arr)}vararr=[243,45,23,356,3,5346,35,5];// calling the bubbleSort FunctionbubbleSort(arr)