These are for demonstration purposes only. There are many implementations of sorts in the JavaScript standard library that are much better for performance reasons.