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.html
inside 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.
0 comments