— Deno, JavaScript, Web Development — 1 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.
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.
hello.ts
and open it in your editor.hello.ts
file:1console.log("Hello, World!");
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.
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!
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.