JavaScript code can be run outside a browser using the open-source, cross-platform runtime environment known as Node.js. It is used to create scalable network applications for streaming media, web servers, and real-time chat.