Skip to content
DeveloperMemos

Creating a Hello World App With Deno

Deno, JavaScript, Web Development1 min read

In this tutorial, we will walk through the process of creating a basic "Hello World" app using Deno. Deno is a modern runtime for JavaScript and TypeScript that provides built-in security features, a modular design, and a robust standard library.

Prerequisites

Before getting started, make sure you have Deno installed on your system. You can install Deno by following the instructions provided in the official documentation at deno.land.

Creating the Hello World App

  1. Open a text editor or an integrated development environment (IDE) of your choice.
  2. Create a new file called hello.ts and open it in your editor.
  3. Add the following code to the hello.ts file:
1console.log("Hello, World!");
  1. Save the file.

Running the App

To run the app, open a terminal or command prompt, navigate to the directory where you saved the hello.ts file, and enter the following command:

1deno run hello.ts

The output should be:

1Hello, World!

Congratulations! You have successfully created and executed your first Deno app.

Adding Functionality

Let's enhance our "Hello World" app by adding a function that takes a name as input and prints a personalized greeting. Modify the hello.ts file as follows:

1function greet(name: string) {
2 console.log(`Hello, ${name}!`);
3}
4
5const name = "Alice";
6greet(name);

Save the file and run it again using the same command as before:

1deno run hello.ts

The output should now be:

1Hello, Alice!

Wrapping Up

In this tutorial, we have learned how to create a simple "Hello World" app with Deno. You can now start exploring Deno's extensive capabilities and build more sophisticated applications using this powerful runtime.