Whether its Javascript or any other language, I think writing algorithms is a great way of driving home certain concepts when you are learning algorithms. Its even more fun to use your data structures and algorithms to solve toy problems and see the difference. Obviously, this is not recommended in production where one must use battle-tested code.
I did a similar exercise when I was doing a course on Coursera in Python - https://github.com/prakhar1989/Algorithms