ES6 | Environment Setup

ES6 can run on local machines, only it needs a browser and a text editor. Otherwise, ES6 can run on any host, on any OS. For ES6, it may not be an all-time execute on the browsers. So we need some extra mechanism to executes the ES6 version.

  • NodeJS
  • Code Editor
  • Browser

NodeJS: For web server, NodeJS is an open-source, cross-platform, JavaScript run-time environment that executes JavaScript code outside of a browser. To install the NodeJS in your machine follow the below links.

Code Editor: To write the executable code we will require a text editor. In my opinion, VS code editor is the first choice you can choose. To install VS Code follow the below links.

Browser: To run the ES6 program. I prefer to use Google Chrome, there are so many other browsers like Firefox, Internet Explorer, Safari.

Execute the ES6 code:

  • Step 1: Now make a folder anywhere of your PC and run command prompt in that folder and make a HTML file by using VS Code editor paste the below code inside the file and save it.
    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    <!DOCTYPE HTML>
    <html lang="en">
        <head>
            <meta charset="UTF-8"/>
            <meta name="viewport"
                  content="width=device-width, 
                  initial-scale=1.0"/>
            <meta http-equiv= "X-UA-Compaible" 
                  content="ie=edge"/>
            <title>hello world!</title>
        </head>
        <body>
            <h1>GeeksforGeeks</h1>
            <b>A Computer Science Portal for Geeks</b>
        </body>
    </html>

    chevron_right

    
    

  • Step 2: Then write the below command in the command prompt, and hit enter.
    npm install http-server -g

    npm is a package manager for the JavaScript programming, by default it is provided by the NodeJS. Full form of npm is Node Package manager. It has many libraries and we can easily use them by Node. here we are use a library http-server to establish server.

  • Step 3: Then, after the installation below command will turn on the server.
    http-server -p 1234
    //1234 is a random port number

  • Step 4: After that, open your browser and write below URL in the search box. Then, the HTML page you make earlier after making the folder will show on the web.
    localhost:1234/filename.html

full-stack-img




My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.