1. Using JavaScript in HTML

2. Using HTML inside JavaScript

3. Single-line and Multi-line Comments

We use // for single-line comments and /* ... */ for multi-line comments.

4. Use of Variables (var, let, const)


5. How to Write Variable Names

Variable names are case-sensitive (age and Age are treated as different variables).

Variable Name Valid? Why?
first-name ❌ Wrong Hyphens are treated as minus signs.
firstName ✅ Correct CamelCase format (Best Practice).
99name ❌ Wrong Cannot start with a number.
name99 ✅ Correct Numbers are allowed in the middle or end.
let ❌ Wrong Reserved keyword in JavaScript.
first name ❌ Wrong Spaces are not allowed.
first_name ✅ Correct Snake_case format using underscores.

6. Declaring Multiple Variables with a Single var

7. Printing Structured Data

8. Quirks of var (Redeclaration & Scope)

9. Introduction to let

Unlike var, you cannot redeclare the same variable name using let in the same scope, and it respects block scope.

10. Use of const (Constants)

With const, you declare a variable whose value cannot be changed or reassigned later.