I was inspired to do this in JavaScript after getting asked this question on several interviews. I've never really found this exercise that interesting or useful in my day to day work. However, adding the visualization for the BST made this more fun.