Learn DENO-PLAYGROUND with Real Code Examples
Updated Nov 26, 2025
Code Sample Descriptions
1
Hello World in Deno Playground (TypeScript)
console.log("Hello World");
A simple Hello World program written and run in Deno Playground using TypeScript.
2
Deno Playground HTTP Server
import { serve } from "https://deno.land/std@0.203.0/http/server.ts";
serve(req => new Response('Hello World', { status: 200 }));
A basic HTTP server using Deno that responds with 'Hello World'.
3
Deno Playground File Read Example
const data = await Deno.readTextFile('example.txt');
console.log(data);
Reads a local text file and prints its contents to the console.
4
Deno Playground Fetch Example
const res = await fetch('https://api.github.com');
const data = await res.json();
console.log(data);
Fetches data from a public API and prints JSON response.
5
Deno Playground Write File Example
await Deno.writeTextFile('output.txt', 'Hello Deno');
console.log('File written!');
Writes text into a file using Deno.
6
Deno Playground Environment Variables
const value = Deno.env.get('MY_VAR') || 'Not set';
console.log(value);
Accesses an environment variable and prints its value.
7
Deno Playground Path Example
import { join } from "https://deno.land/std@0.203.0/path/mod.ts";
const path = join('folder', 'file.txt');
console.log(path);
Uses Deno's path module to join paths.
8
Deno Playground Timer Example
let count = 0;
const interval = setInterval(() => {
console.log(`Tick: ${count}`);
count++;
if(count>5) clearInterval(interval);
}, 1000);
Shows a simple interval timer that prints every second.
9
Deno Playground Command Line Args
console.log(Deno.args);
Prints command line arguments passed to the script.
10
Deno Playground JSON File Example
const json = await Deno.readTextFile('data.json');
const obj = JSON.parse(json);
console.log(obj);
Reads a JSON file and logs its parsed contents.