Javascript Yoga

Javascript Yoga

To do yoga with JS I have chosen vscode

Steps:

  • Open the Editor

Screenshot 2021-01-06 at 12.39.34 PM.png

  • Create a folder for your JS code, for me, I am using a folder named JS-yoga and it can be on anywhere.

Screenshot 2021-01-06 at 12.50.55 PM.png

  • Create a sub-folder called .vscode

Screenshot 2021-01-06 at 12.53.07 PM.png

  • Create a task.json file to run with JS code and add the task run commands in JSON format.

    {
      "version": "0.1.0",
      "command": "node",
      "isShellCommand": true,
      "args": [
          "--harmony"
      ],
    
      "tasks": [
          {
              "taskName": "runFile",
              "isTestCommand": true,
              "suppressTaskName": true,
              "showOutput": "always",
              "problemMatcher": "$jshint",
              "args": ["${file}"]
          }
      ]
    }
    

Screenshot 2021-01-06 at 12.54.19 PM.png

  • 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

Screenshot 2021-01-06 at 1.12.48 PM.png

  • Select your task For me its runFile

Screenshot 2021-01-06 at 1.14.12 PM.png

  • Now your output of JS code will appear on the terminal of vscode

Screenshot 2021-01-06 at 1.15.27 PM.png

For more convenience you can add a key shortcut to run the task

Steps:

  • Go to menu and open Keyboard Shortcuts

Screenshot 2021-01-06 at 1.20.59 PM.png

  • Open the keybindings.json

Screenshot 2021-01-06 at 1.21.41 PM.png

  • Add your desired key to run the task For me, the key is cmd+r, so add the below code
    [
      {
          "key": "cmd+r",
          "command": "workbench.action.tasks.test"
      }
    ]
    

Screenshot 2021-01-06 at 1.22.36 PM.png

  • Now go to the js file tab and press the added key to run the code For me, I am pressing cmd+r

Screenshot 2021-01-06 at 1.26.58 PM.png

Tada...

This article is for javascript beginners. Hope that's gonna help you guys.

#Conclusion Help to grow other developers and yourself.

Love and best wishes to all creators.

If you found this article interesting please consider following me on Twitter, facebook