2οΈβ£β‘Run and Test Your Code - Option 2: Use Live Server
β‘Run and Test Your Code - Option 2: Use Live Server
Once youβve downloded the source code, you need to run it in a browser to see the result.
You have three main ways in this lesson will discuss option 2:
β‘ Option 2: Use Live Server (Recommended)
Live Server is a VS Code extension that runs a lightweight development server.
This way, your changes appear instantly in the browser.
π§ Steps to Use Live Server:
- Open VS Code.
- Go to the Extensions tab (left sidebar, icon with 4 squares).
- Search for βLive Serverβ .
- Install it. (we already done that in the previous lessons)
- Open your project folder in VS Code.
- Right-click
index.htmlinside VS Code β select βOpen with Live Serverβ. - Your browser will open automatically at:
http://127.0.0.1:5500/index.html
- (port number may vary).
- β Now whenever you save changes in VS Code, the browser reloads automatically.
π Why Live Server is Better?
- Auto-reload on save.
- Simulates a real server environment. for HTML, CSS , and Javascript.
- Works well with modern JS features (like
fetch& APIs). - Boosts productivity π.
π Now you can test and run JS code with live server.
1 comments