- Open the Editor
- Create a folder for your JS code, for me, I am using a folder named JS-yoga and it can be on anywhere.
- Create a sub-folder called .vscode
- Create a task.json file to run with JS code and add the task run commands in JSON format.
“ — harmony”
- Now it’s time to add your JS code file, place code whatever you are learning today on JS.
And add that .js file to your root directory path.
For me, the file structure is like
JS-yoga > yoga.js
- Now run your code
Terminal > Run Task
- Select your task
For me its runFile
- Now your output of JS code will appear on the terminal of vscode
For more convenience you can add a key shortcut to run the task
- Go to menu and open Keyboard Shortcuts
- Open the keybindings.json
- Add your desired key to run the task
For me, the key is cmd+r, so add the below code
- Now go to the js file tab and press the added key to run the code
For me, I am pressing cmd+r
Love and best wishes to all creators.