Javascript

Getting Started with Deno — Hands On

PRO

In this section, you'll go hands on with Deno. Some new concepts will be introduced in this section. We will go over them enough for you to understand what you are doing, but likely not in great depth. Many of those concepts we will cover more in depth later on in the course.

In Deno, you just need to write valid JavaScript or TypeScript code. You don't need to worry about a build step. Just write the code and run the file. That's really convenient because it cuts out a lot of setup time.

Deno uses ES modules to import from third party modules, so you can't use the require('/path/to/file') syntax. If you want to import from a file, you do it like this:

import { myFunction } from '/path/to/file';

The /path/to/file shown above can be on the local machine or a remote URL. A real URL that you might import from is "https://deno.land/std@0.74.0/log/mod.ts". The "@0.74.0" part of that URL points to a specific version of the file. If you leave that part out, the program will use the latest version of the file.