Another way to run your JavaScript code is by using the terminal or Cmd in Windows. So here, I'm going to search for the Terminal Terminal. And I'm going to open the terminal. And once you open the terminal, you need to get to the location where your your JavaScript file is. So my JavaScript file, as you can see, is on my desk is on my desktop. So here I'm going to use CD to change directory and then desktop and hit Enter.
And as you can see, I have changed the current directory of my terminal to the desktop. Now what you need to do is you need to type Knight and then JavaScript the name of the file here my my file name is JavaScript dot j s. So we need to type that here. Java Script dot j s If your file name is different, just just add the file name, dot j s, of course, after you type note, and then hit enter. And as you can see, this is test has been printed, because once you hit enter, it's going to execute what is inside that file. What is inside our file is this is a test. So this is a second way of running our JavaScript code, but we are not going to use this.
The the one of the methods that we are going to use most of the time is this one, because this, this one is much easier. Once you save and build, it's going to run your program in your console instead of just going each time to the to the terminal to run your code. And if you are a Windows user, just use the CMD in Windows and do the same exact thing. Just go to the location where your your file is And then type node and then the name of the file. And then finally, dot j s like this. And then hit enter, it's going to print out or it's going to execute the code inside your file.