BCA Student Stories & UpdatesLive
JavaScript Introduction: <script> Tag, Variables (let, const) & Data Types
JavaScript is the programming engine of the web. While HTML provides the skeleton and CSS provides the skin, JavaScript provides the nervous system and dynamic brain, enabling computations, user interactions, and DOM modifications.
Day 21 Step-by-Step Practical Flow
🎯1. What You Will Learn Today
JavaScript Introduction: <script> Tag, Variables (let, const) & Data Types — Comprehensive Practical Guide
Har concept ko visual mental models, code anatomy aur practical industry tips ke sath samjhein.
JavaScript is the programming engine of the web. While HTML provides the skeleton and CSS provides the skin, JavaScript provides the nervous system and dynamic brain, enabling computations, user interactions, and DOM modifications.
"Think of const like a student ID card number (permanent once issued), let like a whiteboard tally of test scores (erased and rewritten as marks update), and console.log like the airplane black-box cockpit recorder."
👨🏫3. Teacher Demonstration Code
See how const protects values from accidental reassignment while template literals cleanly inject variables into strings.
<!DOCTYPE html>
<html>
<head><title>Day 21 JavaScript Demo</title></head>
<body>
<h2>Open Chrome DevTools (F12 -> Console)</h2>
<script>
const studentName = "Aarav Sharma";
const rollNumber = 240101;
let currentSemester = 1;
let isEnrolled = true;
console.log(`Student: ${studentName} (Roll: ${rollNumber})`);
console.log("Type of studentName:", typeof studentName);
console.log("Type of rollNumber:", typeof rollNumber);
console.log("Type of isEnrolled:", typeof isEnrolled);
</script>
</body>
</html>2. Hands-On Practical Lab: Follow Instructions in VS Code
Code like a professional software engineer! Follow the step-by-step instructions below in Visual Studio Code (VS Code) on your PC, test your output locally, and push to GitHub.
Day 21 Practical Task Test Studio
Declare a const variable named studentName with a string value, and a let variable named attendanceScore with a number value.
Call console.log to print studentName and attendanceScore to the terminal/browser console.
Spot the Bug: Illegal Assignment to Constant Variable
Tap or click on the exact line below that contains the error:
Click any code lineconst semesterMarks = 450;semesterMarks = 475; // Error occurs hereconsole.log("Updated Marks:", semesterMarks);Senior Developer Forensic Analysis:
Variables declared with const cannot be reassigned. Attempting to assign a new primitive value throws TypeError: Assignment to constant variable.
📝Independent Practice: Assignment
📄 developer-spec.htmlPersonal Developer Specification Script
- •Create day-21/index.html with valid HTML5 boilerplate.
- •Declare 5 variables covering string, number, boolean, null, and undefined types.
- •Use template literals to print a 4-line developer summary to console.log.
- •Inspect the script in Google Chrome DevTools console and verify zero errors.
Open Visual Studio Code on your PC (code .), create developer-spec.html, paste this complete step-by-step verified code, test in your browser, and push to your GitHub repo:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>BCA Day 21 - JavaScript Variables & Data Types</title>
<style>
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: 'Segoe UI', Tahoma, sans-serif;
background: #0b1120;
color: white;
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
padding: 20px;
}
.spec-card {
background: #1e293b;
border: 1px solid #334155;
border-radius: 16px;
padding: 32px;
max-width: 480px;
width: 100%;
}
h1 { font-size: 20px; color: #38bdf8; margin-bottom: 12px; }
pre {
background: #0f172a;
padding: 16px;
border-radius: 8px;
font-size: 13px;
color: #34d399;
white-space: pre-wrap;
}
</style>
</head>
<body>
<div class="spec-card">
<h1>JavaScript Developer Profile Specification</h1>
<pre id="output">Loading developer profile variables...</pre>
</div>
<script>
// 1. Declare 5 variables representing core primitive types
const developerName = "Er. Manoj Kumar"; // String
const semester = 1; // Number
const isEnrolledBCA = true; // Boolean
const graduationProject = null; // Null (intentional absence of value)
let thesisAdvisor; // Undefined (unassigned)
// 2. Format a multiline summary using ES6 Template Literals
const summary = `Developer Name: ${developerName}
Semester: Semester ${semester}
Active Enrollment: ${isEnrolledBCA ? "Verified Active" : "Inactive"}
Capstone Project: ${graduationProject === null ? "In Progress (Sprint 1)" : graduationProject}
Thesis Advisor: ${typeof thesisAdvisor} (Assigned in Year 3)`;
// 3. Log to browser console and render to DOM
console.log(summary);
document.getElementById("output").textContent = summary;
</script>
</body>
</html>🎓4. Viva Check: Mandatory Conceptual Test
What is the primary difference between let and const in modern JavaScript (ES6)?
5. Mandatory Step: Push to GitHub to Unlock Next Lesson
Target Repo: html-css-projects
Exact GitHub Setup Guide & Expected Structure
Day 21 RequirementsFollow these exact folder and file names to prevent verification errors.
index.html: Avoid spaces or custom names like Alan Turing..html or Index.HTML. Linux/GitHub servers are strictly case-sensitive.day-21/ for today so you don't overwrite previous days.main.You are welcome to read all notes, inspect code snippets, and practice all exercises of Day 21 freely! To officially submit your GitHub repository and unlock subsequent days in your portfolio, please complete Day 20: Sprint 2 Capstone: Responsive University Campus Portal first.
Complete Day 20 First