- open terminal,
- create an empty file: touch script.js ,
- edit file and add a simple function: var add = (a, b) => a + b; console. log(add(5, 10));
- run script using node script. js command,
- the output should be 15 .
How do I run a .JS file?
- Install the Code Runner Extension.
How do I run a script in terminal?
Steps to write and execute a script
- Open the terminal. Go to the directory where you want to create your script.
- Create a file with . sh extension.
- Write the script in the file using an editor.
- Make the script executable with command chmod +x
- Run the script using ./
How do I run Nodemon?
Just executing command nodemon index. js will run your project. But if you install Nodemon locally by command npm install nodemon then you have to specify the script. If you name it as start then npm run start or npm start will trigger the server to run.
- On your computer, open Chrome.
- At the top right, click More. Settings.
- Click Privacy and security. Site settings.
- Turn on Allowed (recommended).
To try it, complete the following actions.
- Open the Console. Select Control + Shift + J (Windows, Linux) or Command + Option + J (macOS).
- Cross Browser Testing Tools. …
- Karma + Jasmine + Google Chrome. …
- CodePen. …
- JSBin. …