Paste the body of an async
JS function in the box. It gets (array, bars, utils)
.
array
: The numbers to sort. Modify it directly.bars
: The visual bar elements.utils
: An object with helper functions:
await utils.delay(ms)
: Pauses for animation.await utils.checkStopAndThrow()
: Checks if "Stop" was clicked.utils.updateBarHeight(index, value)
: Updates a bar's height.utils.colorBar(index, "color")
: Changes a bar's color.utils.updateAccuracy()
: Updates the accuracy meter.