Hello World in JavaScript
One console.log. If this prints, Node or the browser console is actually working.
BeginnerBasic ProgramsExample 1 of 10
hello-world.js
1// The simplest JavaScript program2console.log("Hello World");
Output
Hello World
What's going on
console.log("Hello World") is the whole program. No main, no class.
In the browser it shows up in DevTools (F12), not on the page. That confuses everyone once.
In Node: node hello.js. Same text, different window.