Using JS Kernal
console.log("Simple Sorting Algorythym");
//array of nums that are going to be sorted through
var numArr = [9,3,1,23,91,13,1092,72]
// takes an array of numbers
function sortNum(arr){
//Outer pass
for(let i = 0; i < arr.length; i++){
//Inner pass
for(let j = 0; j < arr.length - i - 1; j++){
//Value comparison using ascending order
if(arr[j + 1] < arr[j]){
//Swapping
console.log(arr);
[arr[j + 1],arr[j]] = [arr[j],arr[j + 1]]
}
}
};
return arr;
};
console.log(sortNum(numArr));