skip to Main Content

I’m using VS code as my code editor (not sure if it’s relevant). My first project is on Changing Background Color. Once I’m done writing my codes, how do I get them to show on a browser?

I’m not sure how to get it to show on a browser.

3

Answers


  1. You want see your code in browser you will open live server of the code docoument –

    open a HTML file and right-click on the editor and click on Open with Live Server .

    or just type this url in browser

    http://127.0.0.1:5500/
    

    5500 is a default port

    or just install an extensions live server it will directly open the browser.

    Login or Signup to reply.
  2. The best way in my opnion to execute JavaScript in your browser is to put it inside a script element inside an HTML document.
    I mean that in the same folder that you have the js file, create an html file and in there put the script link of the file.

     <script src="script.js" defer></script>
    

    This need to be in the <head></head>

    Login or Signup to reply.
  3. hi in vscode download live server then click html file with right click and open with browser

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search