Hello World
With everything in place, let's write our first program!
First, we need to create a file named my-first-deno-program.js
and write something that we're familiar with. We'll use the console
API to write a message to the console:
console.log('Hello from deno');
To execute this, let's use the CLI we installed in the previous section. The command we must use to execute programs is called run
:
$ deno run my-first-deno-program.js Hello from deno
Tip
All Deno CLI commands can be executed with the --help
flag, which will detail all the command's possible behaviors.
At this point, we haven't really done anything we don't know what to do already. We just wrote a console.log
file in the language that we're familiar with, JavaScript.
The interesting thing is that we learned how to execute programs by using the run
command. We'll explore this in more detail later in this chapter.
REPL
The Read Eval...