#2 JavaScript tutorial || How to setup Visual Studio Code and Run a program in JavaScript.

Publicado em: 13 Setembro 2020
no canal de: RockOnCode
630
78

In this tutorial, we will be running our first JavaScript program which is a basic Hello World program where we ill simple print Hello World(or any other text) on the browser.
The 2 software needed to start off with JavaScript are -
IDE: I will be using Visual Studio Code Text Editor which is highly recommended by many especially for Javascript, however, you can use any other text editor like Atom or Sublime text, etc.
Browser: Of course a browser is needed to load the HTML document and run the JavaScript so I will be using the Mozilla Firefox browser. You can use any browser of your choice as most modern browsers have JavaScript enabled by default.
There are 3 ways to include JavaScript in your HTML Document -
Embedding JavaScript in the same HTML document
Using an External JavaScript file and linking it in your HTML document.
1. Embedding JS in HTML document -
As you can see in the code below, we are embedding JS code using the script tag of HTML. Usually, when the JavaScript code is small it is directly embedded in the HTML document, however, it is not recommended to embed large-sized JS code directly in the HTML document as the code becomes un-organized.

2. External JavaScript File -
As you can see below there are 2 files - one the actual HTML document and the other a separate external javascript file (Home.js). This Home.js file is linked in the HTML document using the script tag with the use of the attribute src as shown in the code below. When the javascript code is large, it is highly recommended to use a separate external file to keep the HTML doc and the JS code organized. you can also use another function like Console.log to print the output in javascript.

3. Run in Terminal -
After completion of the code, you can directly open the terminal window, give the root directory path of the file where you have saved the code.
In the terminal window give the command like node filename.js.
You can find your output.


Nesta página do site você pode assistir ao vídeo on-line #2 JavaScript tutorial || How to setup Visual Studio Code and Run a program in JavaScript. duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário RockOnCode 13 Setembro 2020, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 630 vezes e gostou 78 espectadores. Boa visualização!