Hello World in Logo
Our first program will print the classic “hello world” message. Here’s the full source code.
To run the program, save the code in a file named hello-world.js
and execute it using Node.js.
In JavaScript, programs are typically interpreted and run directly by the JavaScript engine in the browser or Node.js runtime. There’s no need to explicitly compile JavaScript code.
Sometimes we’ll want to build our programs into more manageable and distributable forms, especially for larger JavaScript applications. We can use bundlers like webpack
or tools like npm
to package our applications.
An example of how to install and run JavaScript using npm
:
- Initialize a new npm project:
- Create and run a script in
package.json
:
Add the following scripts section to your package.json
:
- Execute the script using npm:
Now that we can run and build basic JavaScript programs, let’s learn more about the language.