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

Function swap

sorting/three-num-sort.js:65–69  ·  view source on GitHub ↗
(first, second, array)

Source from the content-addressed store, hash-verified

63 }
64
65 function swap(first, second, array) {
66 const temp = array[first];
67 array[first] = array[second];
68 array[second] = temp;
69 }
70 const array = [1, 0, 0, -1, -1, 0, 1, 1];
71 const order = [0, 1, -1];
72 console.log(threeNumberSort(array, order));

Callers 1

threeNumberSortFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected