JSJavaScript · Lesson 1 of 14
Hello, World!
You can run JavaScript in your browser's console right now. Open DevTools (F12), click Console, and type. You're already set up. Relax.
JavaScript has two environments: the browser and Node.js. In the browser, you'd use console.log(). In Node.js, same thing. The function is identical — the output just goes to different places.
In a browser, you can also display output in the HTML page itself. But for learning, console.log() is almost always what you want.
◆ Note
JavaScript files run top-to-bottom. There's no main() function required — code at the top level executes immediately when the file is loaded or run.
JavaScript files run top-to-bottom. There's no main() function required — code at the top level executes immediately when the file is loaded or run.