</html>Code language: HTML, XML (xml)
To see the output open the HTML file and open the developer console then you can see the output or in you can open the console directly by clicking “ctrl+shift+j” on windows or “command +option+j” on mac. Also by right-clicking inspect > console.
Code language: Bash (bash)
If it is not downloaded. Download it from here nodejs once again run the command
node --version on your terminal. To check whether it’s appropriately downloaded or not. The latest version is 19.0.1 but I recommend you use the earlier version as it will have no bugs.
Now open your command prompt and enter the command node. The version you are using prints on the screen.
Welcome to Node.js v18.12.1.
Type ".help" for more information.
Now You can enter your code here. For example to print hello world
> console.log("hello world")
Well it’s a bit difficult to write code in the terminal, isn’t it? You can write the source code in your favourite IDE and can run it through the node. Let me show you how to do that. First, let’s create an app.js file and then write your source code in your IDE.
Open the terminal then navigate to your app.js file through basic commands like cd. Then enter node app.js . For example, I created an app.js file to print hello world in the code directory which is a sub-directory of the Desktop directory
Node js is a great platform but we face a lot of errors running the source code, downloading and resolving these errors consumes a lot of time. At codedamn, we provide a free online node js playground. Here is the link to it nodejs-playground.
To use the playground first open the link above mentioned. If you are new to Codedamn signup to create your Codedamn account then click on node js to create your first project then start writing your code. It is the same as node js to run the code enter node <projectname> in the terminal below. You can share the source code with your friends and colleagues. It is easy to use no need to go through the hectic download process. You check out other free online IDE also they are very much useful there are HTML/CSS, C/C++, Python, Solidity, etc. Using Codedamn playground you can create web applications without leaving the browser. Check out them once
For Windows users Bun is still not yet released you can use it through WSL(Windows Sub-system Linux). To download WSL on windows follow the steps mentioned here. Now you can download BUN on macOS, Linux, and WSL by entering the following command in your shell
Code language: Bash (bash)
$ curl https://bun.sh/install | bash
Once you installed it you can run your files using the run command
Code language: TypeScript (typescript)
$ bun run app.ts
Unlimited access to all platform courses
100+ practice projects included
ChatGPT Based Instant AI Help
Structured Full-Stack Web Developer Roadmap To Get A Job
Exclusive community for events, workshops
Sharing is caring
Did you like what Thrishank wrote? Thank them for their work by sharing it on social media.