How the web works and JavaScript as the brain of the browser
Grade XII • Computer Science ⏱️ ~40 minBrief Intro — Web Foundations & JavaScript Fundamentals
HTML & CSS build the structure and style of web pages, but JavaScript makes them think and respond. Understanding how the web works and mastering JavaScript fundamentals is essential for creating interactive, dynamic web experiences.
In this activity, you'll explore web technology concepts, learn how to include JavaScript in your pages, understand JavaScript syntax, variables, operators, functions, and control structures through hands-on experiments.
Understanding the infrastructure that powers the World Wide Web and how web pages are delivered.
Task 1: Internet vs WWW & Web Components
What is the difference between the Internet and the World Wide Web, and what are the key components?
Answer: Internet is the network infrastructure; WWW is the system of hypertext documents on it. Components include web pages, web sites, and web servers.
Task 2: Dynamic vs Static Pages & Scripting
What is the difference between static and dynamic pages, and client-side vs server-side scripting?
Answer: Static pages show fixed content; dynamic pages change. Client-side scripts run in browsers; server-side scripts run on servers for dynamic data processing.
JavaScript is the scripting language that brings interactivity to web pages.
Task 3: What is JavaScript & Ways to Include It
What is JavaScript and how can you include it in HTML pages?
Answer: JavaScript is a lightweight interpreted language for web interactivity. Include via inline script, internal script section, or external .js file.
Task 4: JavaScript Frameworks
What role do JavaScript frameworks play in modern web development?
Answer: JavaScript frameworks are pre-written libraries that simplify development by providing ready-made functions and components.
The building blocks of JavaScript programming.
Type a JavaScript expression and click Run to see the result. Experiment with operators, variables, and functions.
Task 5: Statements, Comments & Keywords
What are JavaScript statements, comments, and keywords?
Answer: Statements are programming instructions. Comments (// or /* */) are ignored. Keywords are reserved words like var, let, const, if, function.
Task 6: Variables & Data Types
How do you declare variables in JavaScript and what are the data types?
Answer: Declare variables with var/let/const. Primitive types: number, string, boolean, null, undefined. Identifiers start with letter/_/$ and are case-sensitive.
Task 7: Operators
What are the different types of operators in JavaScript?
Answer: JavaScript has arithmetic, assignment, string (concatenation), comparison, logical, and type operators.
Functions allow code reuse and are fundamental to JavaScript programming.
Task 8: What is a Function?
What is a JavaScript function and why are they useful?
Answer: Functions are reusable code blocks that perform specific tasks. They allow code reuse and can produce different results with different arguments.
Task 9: Writing & Calling Functions
How do you write and call a function with parameters and return values?
Answer: Define functions with parameters; they behave as local variables. Use return to send values back. Call functions with arguments to execute them.
Control structures allow programs to make decisions and repeat actions.
Task 10: Decision Control
What are the decision control structures in JavaScript?
Answer: Decision structures include if (condition true), else (condition false), else if (new condition), and switch (many alternatives).
Task 11: Looping Structures
What are the different types of loops in JavaScript?
Answer: JavaScript supports for, for/in, for/of, while, and do/while loops. break exits loops; continue skips to next iteration.
Task 12: Loop Practice
Predict the output of this loop, then test it in the JS Value Lab: for (let i = 0; i < 5; i++) { console.log(i); }
Answer: Output: 0, 1, 2, 3, 4. The loop runs 5 times (i = 0, 1, 2, 3, 4) then stops when i becomes 5.
Ready to test your knowledge?
Take the Assessment →