selection sort javascript
let selectionSort = (arr) => {
let len = arr.length;
for (let i = 0; i < len; i++) {
let min = i;
for (let j = i + 1; j < len; j++) {
if (arr[min] > arr[j]) {
min = j;
}
}
if (min !== i) {
let tmp = arr[i];
arr[i] = arr[min];
arr[min] = tmp;
}
}
return arr;
}
Also in JavaScript:
- convert boolean to string javascript
- javascript set local storage value
- js dom for mobile
- javascript read json file
- React microphone
- add class to radium
- how to remove a value from an array and return the new array in javascript
- scroll to top router link vue
- javascript on hover
- pdf to image javascript
- import all images from folder reactjs
- string + number in javascript
- javascript sort array of objects by key value ascending and descending order
- gatsby-plugin-create-client-paths
- place white and black knights on 2x2 chessboard
- jquery.mask.js
- express.json vs bodyparser.json
- redirect to another domain javascript
- how to create uuid in javascript
- mapstatetoprops redux
- node js try catch
- create window electron
- jimp get image size
- subject in angular 8