Horje
bubbleSort Code Example
bubbleSort
const bubbleSort = (arr) => {
  let temp = 0;
  for (let i = 0; i < arr.length; i++) {
    for (let j = 1; j < arr.length; j++) {
      if (arr[j - 1] > arr[i]) {
        temp = arr[j - 1];
        arr[j - 1] = arr[i];
        arr[i] = temp;
      }
    }
  }
  return arr;
};

console.log(bubbleSort([10, 9, 8, 7, 6, 5, 4, 3, 2, 1]));




Javascript

Related
printing in a single line in javascript Code Example printing in a single line in javascript Code Example
javascript ajax get Code Example javascript ajax get Code Example
document.getelementbyid Code Example document.getelementbyid Code Example
javascript remove uniques from array Code Example javascript remove uniques from array Code Example
check-if-a-javascript-string-is-a-url Code Example check-if-a-javascript-string-is-a-url Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7