Introduction
In this lab, we will explore the implementation of the heapsort algorithm in JavaScript. Heapsort is a comparison-based sorting algorithm that works by dividing an array into a sorted and an unsorted region, and iteratively shrinking the unsorted region by extracting the largest element and moving that to the sorted region. Through this lab, you will gain a deeper understanding of how the heapsort algorithm works and how to implement it using recursion and closures in JavaScript.