HTML and CSS · lesson 25 of 30 · free

JavaScript basics — HTML and CSS for kids

JavaScript makes a web page do things. The keyword let makes a variable, a named box that holds a value. console.log shows a value in the browser’s console and alert shows it in a pop-up box. Numbers add up, but text in quotes is joined side by side — so the text 5 plus the number 3 gives 53, not 8.

▶ Watch how it works

Got it? Practise ↓

Code tip

Line by line — “track each variable as the code runs from top to bottom”

  1. let x = 5; makes a variable x holding 5; x = x + 2; changes it to 7.
  2. console.log(…) writes in the console; alert(…) shows a pop-up box.
  3. Text in quotes + anything = joined text: "5" + 3 → "53".

Use it for: Your first JavaScript, adding a message or a score to a page.

Worked example: ⚡ What does this code print? (Look at the quotes!)
let x = "5";
let y = 3;
console.log(x + y); → 53

  1. x is the text "5" (in quotes), y is the number 3.
  2. Text + number joins them side by side: "5" + 3 = "53".

Check: Without the quotes it would be 5 + 3 = 8 ✓

▶ Watch it animated

✏️ Practice

Work it out in your head or on paper, type the answer and press Check. Stuck? Press “Show me how”.

Right: 0 · Tried: 0

🏁 Lesson 25 test

20 questions. Check each answer, then go to the next one. Get 16 or more right to pass.

🏅 Sign in with Google to earn the 💻 Console Coder badge when you pass — and a certificate when you finish all 10 lessons of Part 3 · Web Development. You can still take the test without signing in.

🖨️ JavaScript Worksheet: Basics

✨ Free AI tutor

Ask the AI tutor about this lesson

Why does it work? When should you use it? Ask in English, मराठी or हिंदी.

Sign in with Google to ask Free — 20 questions a day.

👩‍🏫 HTML and CSS classes near you — online or at home

Prefer a real teacher? TalentJR teachers take live online classes anywhere in India and visit homes in selected cities. Tell us what you need and our team will call you with timings and fees.

Live online classesSmall groups or 1:1 with a teacher, from home, any city.
Teacher at homeA TalentJR teacher visits your home (selected cities).
At a centreClasses at a TalentJR partner centre near you, where available.
Badges, certificates & gifts A badge for every lesson you pass, a certificate for every part you finish, plus TalentJR Points for daily practice. Computer worksheets Flowcharts, block coding, spreadsheets and safe internet.