JavaScript_Tutorial_Handout_Stephanie
JavaScript_Tutorial_Handout_Stephanie
Handout
Author: Compiled by ChatGPT for Stephanie
=============================================================================
===
=============================================================================
===
JavaScript is a programming language commonly used to create interactive effects within web
browsers.
It can manipulate the DOM, handle events, make API requests, and more.
console.log("Welcome to JavaScript!");
📝 Exercise:
=============================================================================
===
=============================================================================
===
📝 Exercise:
=============================================================================
===
MODULE 3: OPERATORS
=============================================================================
===
let x = 10;
let y = 3;
Comparison
📝 Exercise:
=============================================================================
===
MODULE 4: FUNCTIONS
=============================================================================
===
function greet(name) {
console.log(greet("Stephanie"));
// Arrow function
console.log(multiply(2, 5));
📝 Exercise:
=============================================================================
===
MODULE 5: CONDITIONALS
=============================================================================
===
console.log("A Grade");
console.log("B Grade");
} else {
console.log("Needs Improvement");
📝 Exercise:
=============================================================================
===
MODULE 6: LOOPS
=============================================================================
===
console.log(`Counting: ${i}`);
let i = 0;
while (i < 3) {
i++;
📝 Exercise:
=============================================================================
===
=============================================================================
===
console.log(colors[1]); // green
let car = {
brand: "Toyota",
year: 2020,
color: "black"
};
console.log(car.brand); // Toyota
📝 Exercise:
=============================================================================
===
=============================================================================
===
// HTML Example:
// <p id="demo">Hello!</p>
// JavaScript:
📝 Exercise:
=============================================================================
===
MODULE 9: EVENTS
=============================================================================
===
function sayHi() {
alert("Hi there!");
}
📝 Exercise:
=============================================================================
===
=============================================================================
===
// Template literals
console.log(`Welcome, ${userName}!`);
// Destructuring
// Spread operator
📝 Exercise:
=============================================================================
===
FINAL MINI PROJECT: TO-DO LIST APP
=============================================================================
===
Features:
- Add tasks
- Delete tasks
// HTML (example):
// <button onclick="addTask()">Add</button>
// <ul id="taskList"></ul>
function addTask() {
const li = document.createElement("li");
li.innerText = input.value;
list.appendChild(li);
input.value = "";
=============================================================================
===
=============================================================================
===
Data Types: string, number, boolean, object, array, null, undefined
Common Methods:
=============================================================================
===
NEXT STEPS
=============================================================================
===
Now build something cool, practice more, and share your projects.