MCPcopy Create free account
hub / github.com/betomoedano/JavaScript-Coding-Interview-Questions / swap

Function swap

sorting/bubble-sort.js:28–32  ·  view source on GitHub ↗
(a, b, array)

Source from the content-addressed store, hash-verified

26}
27
28function swap(a, b, array) {
29 const temp = array[a];
30 array[a] = array[b];
31 array[b] = temp;
32}
33const nums = [1, 3, 4, 5, 67, 4, 2];
34console.log(bubbleSort(nums));
35

Callers 1

bubbleSortFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected