Skip to content

Instantly share code, notes, and snippets.

@chiehmin
Created June 4, 2016 15:54
Show Gist options
  • Save chiehmin/b80da4fbdbec17a81f92d7e19d436e1c to your computer and use it in GitHub Desktop.
Save chiehmin/b80da4fbdbec17a81f92d7e19d436e1c to your computer and use it in GitHub Desktop.
const sort = (arr) => {
const l = arr.length;
for (let i = 0; i < l; i++) {
for (let j = 0; j < l - i; j++) {
if (arr[j] > arr[j + 1]) {
const t = arr[j + 1];
arr[j + 1] = arr[j];
arr[j] = t;
}
}
}
return arr;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment