I want to implement heap sort using JS, but the result is incorrect. I think my logic is correct. However, I cannot figure out where is wrong in the code. Could anyone help