Most of the languages, runtimes, etc. comes with a REPL that can be used to quickly write statements, run them, and check the output. Here is the definition of REPL from Wiki:
A Read-Eval-Print Loop, or REPL, is an environment where user inputs are read, evaluated, and the results are returned to the user. REPLs provide an interactive environment to explore the language/runtime without writing a program, saving, and running it on the shell. Some examples include the Node.js console, IPython, the Bash shell, and the developer console found in most web browsers.
Deno is no exception. It comes with a fully functional REPL. In this article, we’ll see some examples to learn Deno REPL in detail.
To start REPL, simply run deno without any subcommands:
Deno REPL runs with all permissions
Simple JS operations
Files can be read or written to.
Making HTTP request
The fetch API can be used to make HTTP requests.
An application with dependent modules can be directly pasted into REPL. Deno will download the dependencies and compile the dependencies.
A REPL is a regular Deno process. We can get things like PID, PPID, memory usage, etc.
An interactive code takes the user input and prints it back.
A random UUID can be generated using crypto’s randomUUID function.
That’s all about some use-cases of REPL.
This story is a part of the exclusive medium publication on Deno: Deno World.