Can I Implement a Well-Trusted Protocol with Well-Trusted Libraries in JavaScript securely?
If you have to implement or design and implement your own protocol then using well established libraries is generally the way to do it. JavaScript is a large eco-system. For such ecosystems it is not adviced to implement your own (partial) "hazardous materials" library for the low level functionality that you require. It is much more likely that there is something out there that would be more secure.

Of course, if there already is a higher level protocol or protocol implementation out there then you should definitely try and use or improve that. Developing transport security - which is often what is tried with JavaScript - is very hard.  This is why most of the time the best solution is to use TLS underneath.