Introduction
Deno REPL lets you quickly try out JavaScript or TypeScript code without making files. It helps you test ideas fast.
Deno REPL lets you quickly try out JavaScript or TypeScript code without making files. It helps you test ideas fast.
deno repl
deno repl
> console.log('Hello from Deno REPL!') Hello from Deno REPL! undefined
> const sum = (a, b) => a + b undefined > sum(5, 7) 12
This example shows starting the REPL, defining a simple function, and calling it to see the output immediately.
deno repl // Then type the following lines inside the REPL: > const greet = (name) => `Hello, ${name}!` undefined > greet('friend') 'Hello, friend!'
The REPL supports both JavaScript and TypeScript syntax.
Use Ctrl+C twice to exit the REPL safely.
You can import modules inside the REPL using import statements.
Deno REPL is a quick way to test code without files.
It helps you learn and debug interactively.
Start it by running deno repl in your terminal.
deno repl command?deno repl command opens this interactive shell for Deno code testing.deno repl to launch the interactive shell.deno run repl, deno start repl, and deno shell are invalid commands.const x = 5; const y = 10; x + y;
x and y are assigned 5 and 10 respectively.x + ylet a = 10 let b = 20 console.log(a + b)What is the likely cause of the error?
let a = 10 and let b = 20 cause syntax error in REPL.function square(n) {
return n * n;
}
square(4); uses semicolons and braces correctly, which is good practice in REPL.square(4); as last line prints 16 automatically in REPL.Pass the test and this pattern moves unknown