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:

  1. Open VS Code.
  2. Go to the Extensions tab (left sidebar, icon with 4 squares).
  3. Search for “Live Server” .
  4. Install it. (we already done that in the previous lessons)
  5. Open your project folder in VS Code.
  6. Right-click index.html inside VS Code → select “Open with Live Server”.
  7. 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.


Complete and Continue  
Discussion

0 comments