OnlineCBT Logo OnlineCBT
JavaScript Tutorial
JAVASCRIPT · LESSON 2

JavaScript Setup: Browser Console & VS Code

By Ratan Updated: 16 Oct 2026

Set up the development environment, execute JS in DevTools Console, and link external .js files.

Level: Beginner to Advanced
Duration: ~60 Mins Deep-Dive

Create a small, repeatable workspace

Use an editor such as VS Code to keep an HTML file and a JavaScript file together. The browser console is for observing output and investigating errors; a temporary console command is not a saved change to your project.

Two files

Create index.html:




  
  JavaScript Lab
  

JavaScript Lab

Create app.js in the same directory:

const title = document.querySelector('#title');
console.log('Script loaded');
console.log({ titleFound: title !== null });
title.textContent = 'JavaScript workspace ready';

Open index.html in your browser. Expect the heading to change and two console entries to appear. defer allows a classic external script to run after document parsing; the file still needs to load successfully.

Use developer tools deliberately

  1. Console: inspect errors and log values.
  2. Sources: set a breakpoint on the text update, reload, and inspect title.
  3. Network: verify app.js returns a successful response when served through a local development server.
  4. Elements: inspect the resulting DOM, remembering that edits there are usually temporary.

Common setup problems

A wrong filename, capitalisation mismatch or relative path can prevent loading. A cached file may show an older version; inspect the requested URL and use the development tools' reload controls when appropriate. Module scripts and network requests should be tested through a local HTTP development server rather than assuming file:// behavior matches deployment.

Practice

Introduce a misspelled variable, reload and locate the filename and line number in the error. Repair it, then set a breakpoint and step through the corrected statement. Never paste unfamiliar code into a console simply because a website tells you to.

हिन्दी संकेत: editor की file save करें, browser reload करें, और error की पहली line पढ़ें। Console में की गई temporary editing file को save नहीं करती।

📝 Live Lesson Practice

HTML/CSS JavaScript Python C++ C PHP
⌨️ Practice Inputs (लाइव इनपुट भरें) (खाली होने पर RED, भरने पर GREEN underline)
💻 Code Editor (Monaco VS Code Engine)
👀 Live Preview
पता संपर्क करें

+91 7877547686

ई-मेल

onlinecbtportal@gmail.com

हेल्पलाइन नंबर

+91 7877547686


डाउनलोड करने के लिए क्लिक करें
Get it on Google Play

ऐप डाउनलोड करने
के लिए Google Play पर
उपलब्ध है

WhatsApp Chat