Hey there! Welcome.
Are you interested in learning Node.js? Then you are in the right place. With our Node.js playground, you can practice and improve your Node skills. Enter & run Node commands and see the results in real time.
Node.js is a runtime (an environment) for running JavaScript outside web browsers. It’s used to build web servers & APIs. It’s also commonly used to build server-side components of full-stack web applications.
Node.js comes with many built-in modules. Some modules that are often used are:
The playground gives you access to a command line. Node.js is pre-installed. You can check the Node version with the node -v command.
Before you can write & execute Node commands, you have to start a REPL (Read-Eval-Print-Loop) session. REPL is basically a console window that takes user input (JavaScript) & returns the results back to the console.
To start a session, simply enter node in the command line & hit enter. The command line will return a > symbol. The > symbol means you can now write and execute your JavaScript code.
Here is an example code snippet for you to try:
console.log(“Woohoo! I am learning Node.”)
The code above will display a message in the console, using Node’s built-in console module.
Here is another example code snippet:
const http = require("http")
http.get("http://kodekloud.com", response => {
console.log(response.statusCode)
})
The code above is a simple example of making a GET request to the specified URL.
To exit from the REPL, you can type .exit or press CTRL+D.
Note: To write & run code that spans multiple lines, make sure to use the editor mode. You can activate the editor mode by typing .editor and then hitting enter.
Please note that you can use the playground for 1 hour. If required, you can extend the usage by 15 minutes by clicking on the icon next to the timer icon.
To access the official Node.js documentation, simply click on the Node.js Docs link at the top of the command line.
We hope you find this playground fun & enjoyable as you learn & experiment with Node.js.
Have fun & happy coding.