VPython in a browser, with good performance, is possible thanks to the RapydScript Python-to-JavaScript compiler. Because the universe of Python functions and libraries is gigantic, RapydScript does not attempt to implement all of that. However, RapydScript is pretty transparent to using all of JavaScript's extensive facilities. If you do searches such as "JavaScript sort" or "JavaScript set" you may well find what you're looking for.
I've found
http://www.w3schools.com/js/ to be quite useful for getting an introduction to and an overview of JavaScript facilities.
I'll comment that JavaScript was originally aimed just at making web pages dynamic, and it was used mostly by web designers. However, in the last few years there has been an explosion of uses, including computational uses, with more and more libraries being created to do fancy things. For example, a colleague named Cody Smith showed me a physics engine that does something remarkable:
http://www.glowscript.org/#/user/Bruce_Sherwood/folder/Pub/program/oimo-falling-spheres