17.How do you hide an element but still keep its space?
Anonymous Quiz
0%
a) display: none;
40%
b) visibility: hidden;
60%
c) opacity: 0;
0%
d) z-index: -1;
How are you finding the content so far?
I'd appreciate your feedback on the comment section.
I'd appreciate your feedback on the comment section.
Anonymous Poll
83%
👍
17%
👎
👋 Hey Campers!
💪 Welcome to Final HTML + CSS Challenge Time
You’ve already done an incredible job! 🌟 Now before we move on to JavaScript 🚀, let’s level up our CSS + HTML practice with 3 more powerful real-world challenges. These will push your creativity, test your knowledge, and help you build projects you’ll be proud of.
💡 Challenge 1: Online Magazine or News Portal 📰
🎯 Goal:
Create a sleek, content-rich online magazine or news website that looks like BBC, CNN, or Addis Standard.
💼 What to Include:
✅ Header with site logo + navigation menu
✅ Main headline section with a featured image and breaking news title
✅ News categories (World, Politics, Tech, Sports, Entertainment)
✅ Use Grid Layout to arrange articles attractively
✅ Sidebar for latest posts or advertisements
✅ Each article card should include:
Image
Headline
Short paragraph
“Read More” button
✅ Add hover effects, box shadows, and transitions
✅ Footer with newsletter signup and social media icons
✅ Responsive design for mobile
🎁 Bonus: Use :hover, object-fit, box-shadow, and flex on cards for a modern feel.
🎵 Challenge 2: Music Player Interface 🎧
🎯 Goal:
Design a Music Player Web Interface just like you’d see on Spotify or Apple Music. This can be simple, static — no need for JavaScript (yet!).
💼 What to Include:
✅ Now Playing section with:
Song title
Artist name
Album cover
✅ Progress bar using CSS range-like styling
✅ Control buttons: play ⏯️, pause ⏸️, next ⏭️, previous ⏮️ — use icons!
✅ Volume control bar
✅ List of songs (playlist style)
✅ Use Flexbox or Grid for layout
✅ Add hover animations to buttons
✅ Add box shadows and border-radius for modern UI
🎁 Bonus: Try positioning with position: fixed for a footer-style music player.
👥 Challenge 3: Fictitious Social Media Page 🌐
🎯 Goal:
Build a fake but stylish version of a social media site like Facebook, Instagram, or Twitter. You don’t need functionality — just design.
💼 What to Include:
✅ Top navbar with logo, search input, and nav icons
✅ Sidebar with menu links (Home, Messages, Friends, Notifications)
✅ Post feed:
Profile photo
Post image or text
Reaction icons
Comment section
✅ Use Flexbox and Grid for layout
✅ Responsive design for mobile view
✅ Use icons like ♥️, 💬, 🔄 — FontAwesome or other libraries
✅ Add hover effects and shadows for cards
🎁 Bonus: Add a “Create Post” input section and style it beautifully.
📣 One Last Push Before JS!
👉 Don’t just scroll — build! 💪
👉 Practice is the key to becoming a web developer.
👉 And hey — if you’re not participating yet, this is your perfect chance to rejoin and impress! 🤝
🎁 After these, we’ll unlock JavaScript superpowers, but CSS is your foundation — let’s make it strong.
🔗 Share your work with the team
🤝 Invite your friends
🌞✌️And stay creative, stay coding, stay warm and well!
💪 Welcome to Final HTML + CSS Challenge Time
You’ve already done an incredible job! 🌟 Now before we move on to JavaScript 🚀, let’s level up our CSS + HTML practice with 3 more powerful real-world challenges. These will push your creativity, test your knowledge, and help you build projects you’ll be proud of.
🗣️ You’ve come too far to stop now!
We noticed some of you haven’t been participating in the group 👀 — please don’t miss this golden opportunity to practice! Learning by doing is how we get better. 💯
💡 Challenge 1: Online Magazine or News Portal 📰
🎯 Goal:
Create a sleek, content-rich online magazine or news website that looks like BBC, CNN, or Addis Standard.
💼 What to Include:
✅ Header with site logo + navigation menu
✅ Main headline section with a featured image and breaking news title
✅ News categories (World, Politics, Tech, Sports, Entertainment)
✅ Use Grid Layout to arrange articles attractively
✅ Sidebar for latest posts or advertisements
✅ Each article card should include:
Image
Headline
Short paragraph
“Read More” button
✅ Add hover effects, box shadows, and transitions
✅ Footer with newsletter signup and social media icons
✅ Responsive design for mobile
🎁 Bonus: Use :hover, object-fit, box-shadow, and flex on cards for a modern feel.
🎵 Challenge 2: Music Player Interface 🎧
🎯 Goal:
Design a Music Player Web Interface just like you’d see on Spotify or Apple Music. This can be simple, static — no need for JavaScript (yet!).
💼 What to Include:
✅ Now Playing section with:
Song title
Artist name
Album cover
✅ Progress bar using CSS range-like styling
✅ Control buttons: play ⏯️, pause ⏸️, next ⏭️, previous ⏮️ — use icons!
✅ Volume control bar
✅ List of songs (playlist style)
✅ Use Flexbox or Grid for layout
✅ Add hover animations to buttons
✅ Add box shadows and border-radius for modern UI
🎁 Bonus: Try positioning with position: fixed for a footer-style music player.
👥 Challenge 3: Fictitious Social Media Page 🌐
🎯 Goal:
Build a fake but stylish version of a social media site like Facebook, Instagram, or Twitter. You don’t need functionality — just design.
💼 What to Include:
✅ Top navbar with logo, search input, and nav icons
✅ Sidebar with menu links (Home, Messages, Friends, Notifications)
✅ Post feed:
Profile photo
Post image or text
Reaction icons
Comment section
✅ Use Flexbox and Grid for layout
✅ Responsive design for mobile view
✅ Use icons like ♥️, 💬, 🔄 — FontAwesome or other libraries
✅ Add hover effects and shadows for cards
🎁 Bonus: Add a “Create Post” input section and style it beautifully.
📣 One Last Push Before JS!
👉 Don’t just scroll — build! 💪
👉 Practice is the key to becoming a web developer.
👉 And hey — if you’re not participating yet, this is your perfect chance to rejoin and impress! 🤝
🎁 After these, we’ll unlock JavaScript superpowers, but CSS is your foundation — let’s make it strong.
🔗 Share your work with the team
🤝 Invite your friends
🌞✌️And stay creative, stay coding, stay warm and well!
❤1
👋 Hello dear campers! 🧑💻✨
Before we jump into JavaScript — the powerful tool that brings interactivity and magic to our websites — let’s take a step back and understand how the web actually works. 😲
We’ve already created beautiful pages using HTML & CSS, but now…
💭 How does your website appear when someone types a link?
💭 Where is your site stored?
💭 What is a domain or a server?
Let’s learn this together — in the simplest way possible using analogies! 🧠💡
🌐 How the Web Works — A Beginner’s Guide
🏠 Imagine the Web as a Giant City
➺Each website is like a house.
➺Each house has an address (called a domain name like google.com).
➺The actual house (your website) is stored in a server — a powerful computer that’s always on and connected to the internet.
1️⃣ You = The Visitor 👤
You open your browser and type:
https://www.mycampersite.com
2️⃣ Browser = The Delivery Person 🛵
The browser is like a delivery guy.
He goes and finds the address you typed.
But first, he needs to know where the house is located.
3️⃣ DNS = The Address Book 📖
The DNS (Domain Name System) is like the city's phonebook/list.
It looks up the name "mycampersite.com" and says:
Now the delivery guy (browser) knows where to go.
4️⃣ Server = The House with Your Website 🏠
The browser travels to that IP address — the server.
🖥️ The server is just a special computer that:
Stores your HTML, CSS, JS, and images.
Sends those files back to the browser when asked
5️⃣ Browser Shows You the Page 🎨
Now your browser receives:
index.html → The structure
style.css → The design
script.js → The interaction
And then it builds and displays the page in front of you! 🚀
📬 In Short:
➝You type a website.
➝Browser asks DNS for the location.
➝Browser visits server and requests files.
➝Server sends back HTML, CSS, JS.
➝Browser builds the page and shows it to you.
🧠🌍 New Analogy: “The Web as a Restaurant”
Let’s imagine…
You're hungry 😋 and want to order food from a restaurant.
Well, that’s just like how your browser orders a website from the internet!
🍴The Characters in Our Story
🍽️ Step-by-Step: What Happens When You Visit a Website?
1️⃣ You make an order (Type a URL)
You say:
That’s like typing a URL in your browser.
2️⃣ The waiter (browser) checks the restaurant’s address
But wait... where is muyalogy.com located?
So the waiter checks the 📖 DNS system — it tells him:
He now knows where to go! 🛵
3️⃣ The waiter travels to the kitchen (server)
He follows the internet roads and reaches the server, which is like the restaurant’s kitchen.
He says:
4️⃣ The kitchen (server) prepares the food (website files)
The chef (server) prepares:
🍞 HTML (structure of the dish — plate, bowl)
🥗 CSS (decoration — colors, layout, presentation)
🌶️ JS (spicy flavor — actions, interactivity)
All neatly packed and ready!
5️⃣ Waiter brings it back & serves it (Browser displays the site)
The browser (waiter) brings the files back, and your screen shows the complete website dish — tasty, styled, and interactive! 🍱✨
🔄 Bonus: What If You Click a Button or Fill a Form?
It’s like asking:
JavaScript sends the request back to the server (kitchen), and brings the new response back without reloading the whole plate!
🔍 Wait… What About Hosting and Domains?
🧳 Hosting = Renting the kitchen (server space) to store your site.
🏷️ Domain = Buying a signboard for your restaurant (your URL name).
When you launch a website:
➝You buy a domain name.
➝You host your files on a server.
➝People use browsers to order the dish (see your site)!
Before we jump into JavaScript — the powerful tool that brings interactivity and magic to our websites — let’s take a step back and understand how the web actually works. 😲
We’ve already created beautiful pages using HTML & CSS, but now…
💭 How does your website appear when someone types a link?
💭 Where is your site stored?
💭 What is a domain or a server?
Let’s learn this together — in the simplest way possible using analogies! 🧠💡
🌐 How the Web Works — A Beginner’s Guide
🏠 Imagine the Web as a Giant City
➺Each website is like a house.
➺Each house has an address (called a domain name like google.com).
➺The actual house (your website) is stored in a server — a powerful computer that’s always on and connected to the internet.
1️⃣ You = The Visitor 👤
You open your browser and type:
https://www.mycampersite.com
2️⃣ Browser = The Delivery Person 🛵
The browser is like a delivery guy.
He goes and finds the address you typed.
But first, he needs to know where the house is located.
3️⃣ DNS = The Address Book 📖
The DNS (Domain Name System) is like the city's phonebook/list.
It looks up the name "mycampersite.com" and says:
“Oh! This is stored at 192.123.45.2 (IP address).”
Now the delivery guy (browser) knows where to go.
4️⃣ Server = The House with Your Website 🏠
The browser travels to that IP address — the server.
🖥️ The server is just a special computer that:
Stores your HTML, CSS, JS, and images.
Sends those files back to the browser when asked
5️⃣ Browser Shows You the Page 🎨
Now your browser receives:
index.html → The structure
style.css → The design
script.js → The interaction
And then it builds and displays the page in front of you! 🚀
📬 In Short:
➝You type a website.
➝Browser asks DNS for the location.
➝Browser visits server and requests files.
➝Server sends back HTML, CSS, JS.
➝Browser builds the page and shows it to you.
🧠🌍 New Analogy: “The Web as a Restaurant”
Let’s imagine…
You're hungry 😋 and want to order food from a restaurant.
Well, that’s just like how your browser orders a website from the internet!
🍴The Characters in Our Story
🍽️ Step-by-Step: What Happens When You Visit a Website?
1️⃣ You make an order (Type a URL)
You say:
“Hey, I want the Home Page Special from muyalogy.com.”
That’s like typing a URL in your browser.
2️⃣ The waiter (browser) checks the restaurant’s address
But wait... where is muyalogy.com located?
So the waiter checks the 📖 DNS system — it tells him:
"This website is at IP 192.123.4.1."
He now knows where to go! 🛵
3️⃣ The waiter travels to the kitchen (server)
He follows the internet roads and reaches the server, which is like the restaurant’s kitchen.
He says:
“I want the homepage, please!”
4️⃣ The kitchen (server) prepares the food (website files)
The chef (server) prepares:
🍞 HTML (structure of the dish — plate, bowl)
🥗 CSS (decoration — colors, layout, presentation)
🌶️ JS (spicy flavor — actions, interactivity)
All neatly packed and ready!
5️⃣ Waiter brings it back & serves it (Browser displays the site)
The browser (waiter) brings the files back, and your screen shows the complete website dish — tasty, styled, and interactive! 🍱✨
🔄 Bonus: What If You Click a Button or Fill a Form?
It’s like asking:
“Can I get a drink too?”🥤
JavaScript sends the request back to the server (kitchen), and brings the new response back without reloading the whole plate!
🔍 Wait… What About Hosting and Domains?
🧳 Hosting = Renting the kitchen (server space) to store your site.
🏷️ Domain = Buying a signboard for your restaurant (your URL name).
When you launch a website:
➝You buy a domain name.
➝You host your files on a server.
➝People use browsers to order the dish (see your site)!
💡 Why is this important before JS?
Because JavaScript is:
➤Run by your browser after it gets the files.
➤Can talk to servers, send/receive data, and control what happens on your site.
➤Helps us build dynamic sites — like filling out forms, animations, chatting, etc.
➤Understanding how browsers and servers work helps you write better, smarter code in JavaScript. 🤖
🧠 Key Terms to Remember:
Browser = Chrome, Firefox, Edge…
DNS = Finds the address of your website
Server = Stores your website files
HTTP/HTTPS = Rules for sending/receiving website data
URL = The link you type (https://...)
Frontend = What users see (HTML/CSS/JS)
Backend = What happens on the server side (we'll learn later!)
🥳 You're ready now!
You now understand the road your website travels from a server to a user.
Next up? JavaScript — to make your site truly alive! 🎉✨
But for now…
📢 Share this with your campmates,
📨 Invite more learners,
🌞 And a warm stay well until the next session!
Because JavaScript is:
➤Run by your browser after it gets the files.
➤Can talk to servers, send/receive data, and control what happens on your site.
➤Helps us build dynamic sites — like filling out forms, animations, chatting, etc.
➤Understanding how browsers and servers work helps you write better, smarter code in JavaScript. 🤖
🧠 Key Terms to Remember:
Browser = Chrome, Firefox, Edge…
DNS = Finds the address of your website
Server = Stores your website files
HTTP/HTTPS = Rules for sending/receiving website data
URL = The link you type (https://...)
Frontend = What users see (HTML/CSS/JS)
Backend = What happens on the server side (we'll learn later!)
🥳 You're ready now!
You now understand the road your website travels from a server to a user.
Next up? JavaScript — to make your site truly alive! 🎉✨
But for now…
📢 Share this with your campmates,
📨 Invite more learners,
🌞 And a warm stay well until the next session!
WEEK 3 DAY 1 JAVASCRIPT LESSON
👋🏽 Hello Brilliant Campers!
Welcome back to our Week 3 — where things get interactive, alive, and fun! 🎉
You’ve all done wonderfully with HTML & CSS, building the structure and beauty of a webpage.
Now, it’s time to take the next big step:
🚀 We’re learning JavaScript, the magical language that makes web pages talk, move, react, and come to life!
We’ll go slowly and deeply, with clear real-life analogies, examples, and code that you can test yourself. Let’s dive in together!
🧠 JavaScript: The Brain Behind the Web
Today, we’ll begin exploring how
to talk to that brain.
📘 JavaScript Lesson 1: A Gentle Introduction
👉 Topic: What is JavaScript, why we need it, and how it works .
🥇 1. What is JavaScript?
JavaScript (JS) is a programming language that lets you add behavior to your website.
✅ HTML is the skeleton (structure)
✅ CSS is the skin and clothes (style)
✅ JavaScript is the muscles and brain (action)
🧠 Analogy:
Imagine a robot doll:
➝HTML is the body made from plastic
➝CSS is the outfit and makeup
➝JavaScript is the chip inside that lets it walk, talk, blink, and dance!
Without JavaScript, websites are static (no reactions). With it, websites become dynamic and interactive.
🎯 2. What Can JavaScript Do?
JavaScript can:
🖱️ React to clicks, typing, mouse movement
📅 Show and hide elements
🔢 Calculate things (e.g. total price)
📦 Store and update data (like shopping carts)
🔄 Update the webpage without refreshing
💬 Interact with users
🌍 Fetch data from servers (like weather, news, etc.)
📚 Real Example:
➺When you click a "Like ❤️" on Facebook — that’s JavaScript.
➺When a form checks if your email is valid — that’s JavaScript.
➺When your phone calculator does math — yep, JavaScript (in web apps)!
🛠️ 3. Where Does JavaScript Run?
JavaScript runs in the browser — Chrome, Firefox, Edge, Safari, etc.
That means you don’t need to install anything — it’s already in your browser!
💡 Imagine your browser is a kitchen, and JavaScript is the chef that does all the cooking.
🧑💻 4. Where Do We Write JavaScript?
There are 2 main places:
➺➺Inside the HTML file using the <script> tag
➺➺In a separate .js file and then linked in HTML. we link it inside body as
Example: Writing directly in HTML
When you click the button, JS shows an alert box. That’s interactivity!
🕹️ 5. How JavaScript Works — Analogy Time!
Let’s take the restaurant analogy again but make it JavaScript-specific.
👩🍳 You = Website visitor
📜 HTML = Menu
🎨 CSS = Food plating style
🧠 JavaScript = The cook who prepares the food only when you order
You click a "Make Order" button ➝ JS says "OK!" ➝ It cooks it ➝ It shows "Order received!" on the screen.
JavaScript is like a smart brain or assistant that listens to your actions and responds.
Final Analogy: Smart House
Imagine your webpage is a smart house:
HTML builds the walls, rooms, and furniture
CSS paints the rooms and adds decorations
JavaScript is the smart system that says:
"If someone enters, turn on the lights."
"If they press a button, play music."
"If it’s 8PM, lock the doors."
That's what JavaScript does — it brings your webpage to life.
👋🏽 Hello Brilliant Campers!
Welcome back to our Week 3 — where things get interactive, alive, and fun! 🎉
You’ve all done wonderfully with HTML & CSS, building the structure and beauty of a webpage.
Now, it’s time to take the next big step:
🚀 We’re learning JavaScript, the magical language that makes web pages talk, move, react, and come to life!
We’ll go slowly and deeply, with clear real-life analogies, examples, and code that you can test yourself. Let’s dive in together!
🧠 JavaScript: The Brain Behind the Web
Today, we’ll begin exploring how
to talk to that brain.
📘 JavaScript Lesson 1: A Gentle Introduction
👉 Topic: What is JavaScript, why we need it, and how it works .
🥇 1. What is JavaScript?
JavaScript (JS) is a programming language that lets you add behavior to your website.
✅ HTML is the skeleton (structure)
✅ CSS is the skin and clothes (style)
✅ JavaScript is the muscles and brain (action)
🧠 Analogy:
Imagine a robot doll:
➝HTML is the body made from plastic
➝CSS is the outfit and makeup
➝JavaScript is the chip inside that lets it walk, talk, blink, and dance!
Without JavaScript, websites are static (no reactions). With it, websites become dynamic and interactive.
🎯 2. What Can JavaScript Do?
JavaScript can:
🖱️ React to clicks, typing, mouse movement
📅 Show and hide elements
🔢 Calculate things (e.g. total price)
📦 Store and update data (like shopping carts)
🔄 Update the webpage without refreshing
💬 Interact with users
🌍 Fetch data from servers (like weather, news, etc.)
📚 Real Example:
➺When you click a "Like ❤️" on Facebook — that’s JavaScript.
➺When a form checks if your email is valid — that’s JavaScript.
➺When your phone calculator does math — yep, JavaScript (in web apps)!
🛠️ 3. Where Does JavaScript Run?
JavaScript runs in the browser — Chrome, Firefox, Edge, Safari, etc.
That means you don’t need to install anything — it’s already in your browser!
💡 Imagine your browser is a kitchen, and JavaScript is the chef that does all the cooking.
🧑💻 4. Where Do We Write JavaScript?
There are 2 main places:
➺➺Inside the HTML file using the <script> tag
➺➺In a separate .js file and then linked in HTML. we link it inside body as
<script src="myjavascript.js" ></script>
Example: Writing directly in HTML
<!DOCTYPE html>
<html>
<head>
<title>My First JS</title>
</head>
<body>
<h1>Welcome!</h1>
<button onclick="sayHello()">Click me</button>
<script> function sayHello() { alert("Hello Camper! 🎉"); } </script>
</body>
</html>
When you click the button, JS shows an alert box. That’s interactivity!
🕹️ 5. How JavaScript Works — Analogy Time!
Let’s take the restaurant analogy again but make it JavaScript-specific.
👩🍳 You = Website visitor
📜 HTML = Menu
🎨 CSS = Food plating style
🧠 JavaScript = The cook who prepares the food only when you order
You click a "Make Order" button ➝ JS says "OK!" ➝ It cooks it ➝ It shows "Order received!" on the screen.
JavaScript is like a smart brain or assistant that listens to your actions and responds.
Final Analogy: Smart House
Imagine your webpage is a smart house:
HTML builds the walls, rooms, and furniture
CSS paints the rooms and adds decorations
JavaScript is the smart system that says:
"If someone enters, turn on the lights."
"If they press a button, play music."
"If it’s 8PM, lock the doors."
That's what JavaScript does — it brings your webpage to life.
💬 Your First Words in JavaScript
Imagine JavaScript is your assistant.
How do you talk to it? You use a very simple phrase:
🔍 What is console.log()?
Think of it as your talking board — a tool to speak to yourself or the browser. It prints messages on the screen — not the webpage, but inside the browser’s "Dev Tools".
🧠 Analogy:
Imagine you're a chef and want to test your new recipe.
Instead of serving it to customers, you taste it yourself in the kitchen and write notes on a whiteboard — that's what console.log() is!
🛠️ How to Use console.log() in Real Life
Let’s try it:
🔸 Example:
🧪 Try It Yourself:
Right-click the page → Click Inspect or Developer Tools
Go to the Console tab
See your messages appear there
🗃️ Variables – Containers to Store Information
🎒 What is a Variable?
A variable is like a box with a name — it stores something inside for later use.
Analogy:
You have a bag labeled "Snacks" 🍫
Inside it, you put 3 candies.
Later, you say: “Give me what’s in Snacks.” — and get your candies!
In JavaScript, we use variables to store:
➺names
➺numbers
➺messages
➺answers
➺results of calculations
📝 Declaring a Variable
We use the keyword let or const:
➝let name = "Liya";
➝let age = 18;
➝const country = "Ethiopia";
💡 let means the value can change.
🔒 const means the value will stay the same.
Note: // this notation helps us to write a comment or information whether for us or for someone else to read it. The program skips it and continues to the next line.
🧠 Example 1 – Declaring and Logging
🧠 Example 2 – Changing Variable Value
But this won’t work:
🧃 Different Types of Data (Data Types)
JavaScript variables can store different types of values.
Here are the main ones:
* string: Text (e.g., "hello").
* number: Integers and decimals (e.g., 10, 3.14).
* boolean: Logical true or false.
🔧 Doing Things With Variables
Let’s play with numbers and text.
💬 Example 1: Combine words
➕ + is used to combine (concatenate) strings
🔢 Example 2: Do math
You’ve made it to the first real step in JavaScript!
Practice your variables, test them in console.log, try changing values, and combine text and numbers.
🧡 Don’t forget to: 🔁 Share this lesson
👯♀️ Invite your fellow learners
✌️ And always stay warm, brave, and curious.
Imagine JavaScript is your assistant.
How do you talk to it? You use a very simple phrase:
console.log("Hello Camper!");
🔍 What is console.log()?
Think of it as your talking board — a tool to speak to yourself or the browser. It prints messages on the screen — not the webpage, but inside the browser’s "Dev Tools".
🧠 Analogy:
Imagine you're a chef and want to test your new recipe.
Instead of serving it to customers, you taste it yourself in the kitchen and write notes on a whiteboard — that's what console.log() is!
🛠️ How to Use console.log() in Real Life
Let’s try it:
🔸 Example:
<!DOCTYPE html>
<html>
<head>
<title>JS Test</title>
</head>
<body>
<script>
console.log("I am learning JavaScript!");
console.log("Day 1 is awesome 🔥");
</script>
</body>
</html>
🧪 Try It Yourself:
Right-click the page → Click Inspect or Developer Tools
Go to the Console tab
See your messages appear there
🗃️ Variables – Containers to Store Information
🎒 What is a Variable?
A variable is like a box with a name — it stores something inside for later use.
Analogy:
You have a bag labeled "Snacks" 🍫
Inside it, you put 3 candies.
Later, you say: “Give me what’s in Snacks.” — and get your candies!
In JavaScript, we use variables to store:
➺names
➺numbers
➺messages
➺answers
➺results of calculations
📝 Declaring a Variable
We use the keyword let or const:
➝let name = "Liya";
➝let age = 18;
➝const country = "Ethiopia";
💡 let means the value can change.
🔒 const means the value will stay the same.
Note: // this notation helps us to write a comment or information whether for us or for someone else to read it. The program skips it and continues to the next line.
🧠 Example 1 – Declaring and Logging
let favoriteColor = "purple";
console.log(favoriteColor); // prints: purple
const campName = "SuperCodeCamp";
console.log(campName); // prints: SuperCodeCamp
🧠 Example 2 – Changing Variable Value
let mood = "happy"; console.log(mood); // happy
mood = "curious";
console.log(mood); // curious
But this won’t work:
const mood = "happy";
mood = "sad"; // ❌ error: can't change a const
🧃 Different Types of Data (Data Types)
JavaScript variables can store different types of values.
Here are the main ones:
* string: Text (e.g., "hello").
* number: Integers and decimals (e.g., 10, 3.14).
* boolean: Logical true or false.
🔧 Doing Things With Variables
Let’s play with numbers and text.
💬 Example 1: Combine words
let firstName = "Liya";
let lastName = "Mekonnen";
console.log(firstName + " " + lastName); // Liya Mekonnen
➕ + is used to combine (concatenate) strings
🔢 Example 2: Do math
let num1 = 10;
let num2 = 5;
console.log(num1 + num2); // 15
console.log(num1 - num2); // 5
console.log(num1 * num2); // 50
console.log(num1 / num2); // 2
You’ve made it to the first real step in JavaScript!
Practice your variables, test them in console.log, try changing values, and combine text and numbers.
🧡 Don’t forget to: 🔁 Share this lesson
👯♀️ Invite your fellow learners
✌️ And always stay warm, brave, and curious.
❤1
Assignment:
➺introduction to js
https://youtu.be/Ihy0QziLDf0?si=zZZLjoucM5tQQ0Is
➺variables
https://youtu.be/nbX0MIV7-Ek?si=NQQ6Brk27ZOgkB22
➺introduction to js
https://youtu.be/Ihy0QziLDf0?si=zZZLjoucM5tQQ0Is
➺variables
https://youtu.be/nbX0MIV7-Ek?si=NQQ6Brk27ZOgkB22
YouTube
JavaScript tutorial for beginners 🌐
#JavaScript #tutorial #course
00:00:00 introduction
00:01:12 VS Code
00:01:30 website folder
00:02:55 HTML setup
00:04:09 Live Server extension
00:05:00 HTML elements
00:05:32 CSS properties
00:06:11 script tag
00:06:34 console.log()
00:07:52 window.alert()…
00:00:00 introduction
00:01:12 VS Code
00:01:30 website folder
00:02:55 HTML setup
00:04:09 Live Server extension
00:05:00 HTML elements
00:05:32 CSS properties
00:06:11 script tag
00:06:34 console.log()
00:07:52 window.alert()…
Week 3, Day 2 JavaScript lesson:
👋 Hello Campers!
🌟 Welcome back to your JavaScript adventure.
Yesterday, we learned about console.log() and variables. Today, we’ll go much deeper with the types of data JavaScript can handle, how to convert between them, and the operators we use to work with them!
🧱 1. JavaScript Data Types
JavaScript works with different types of values. Think of data types as labels for the kind of value a variable is holding.
Here are the main primitive data types:
➤ String 🧵
A string is any text written between quotes: "Hello", 'World', or even
➤ Number 🔢
Represents both integers and decimals.
➤ Boolean ✅❌
This type has only two values: true or false. Useful in conditions!
➤ Undefined 🚫
A variable is declared but has no value yet.
➤ Null 🕳️
It means empty or no value on purpose.
➤ Object 🧳
Holds key-value pairs. It's a container for related data.
🔁 2. Type Conversion in JavaScript
JavaScript often converts data types automatically, but sometimes, you have to do it yourself.
➤ String to Number
➤ Number to String
➤ Boolean to Number
➤ Automatic Type Coercion
JavaScript is sometimes too smart 😅
⚙️ 3. JavaScript Operators
Operators are used to perform actions on values.
➤ Arithmetic Operators ➕
➤ Assignment Operators 📝
Other examples:
➺ a-= 3 means a = a-3
➺a *=3 means a = a * 3
➺a /=3 means a= a /3
➺a %= 3 means a = a % 3
➤ Comparison Operators 🤔
Used to compare two values.
➤ Logical Operators 🧠
📝 4. Comments in JavaScript
Comments are not executed. They're for humans! 🧑🏫
➤ Single Line Comment
➤ Multi-line Comment
🎯 Real Life Example
Let's put it all together:
🎓 Summary
Today we learned:
✅ Primitive data types in JS
✅ How to convert types manually and automatically
✅ Arithmetic, logical, and comparison operators
✅ How to write comments for clarity
🙋🏾♀️ Dear Campers, make sure to experiment with these concepts in your browser or code editor! Open your DevTools, go to the Console tab, and play around 🧪
We’ll keep building one block at a time 🧱
👋 Hello Campers!
🌟 Welcome back to your JavaScript adventure.
Yesterday, we learned about console.log() and variables. Today, we’ll go much deeper with the types of data JavaScript can handle, how to convert between them, and the operators we use to work with them!
🧱 1. JavaScript Data Types
JavaScript works with different types of values. Think of data types as labels for the kind of value a variable is holding.
Here are the main primitive data types:
➤ String 🧵
A string is any text written between quotes: "Hello", 'World', or even
Backticks.let name = "Meresa";
let greeting = 'Hello, Campers!';
console.log(name); // Meresa
➤ Number 🔢
Represents both integers and decimals.
let age = 25;
let pi = 3.14;
console.log(age + pi); // 28.14 ➤ Boolean ✅❌
This type has only two values: true or false. Useful in conditions!
let isLoggedIn = true;
let hasPaid = false;
➤ Undefined 🚫
A variable is declared but has no value yet.
let score;
console.log(score); // undefined ➤ Null 🕳️
It means empty or no value on purpose.
let test = null; ➤ Object 🧳
Holds key-value pairs. It's a container for related data.
let user = { name: "Abel", age: 20, isStudent: true }; 🔁 2. Type Conversion in JavaScript
JavaScript often converts data types automatically, but sometimes, you have to do it yourself.
➤ String to Number
let num = Number("100");
console.log(num + 1); // 101 ➤ Number to String
let num = 30;
let str = String(num);
console.log(str); // "30" ➤ Boolean to Number
console.log(Number(true)); // 1
console.log(Number(false)); // 0 ➤ Automatic Type Coercion
JavaScript is sometimes too smart 😅
console.log("5" + 5); // "55" (string)
console.log("5" - 2); // 3 (number) ⚙️ 3. JavaScript Operators
Operators are used to perform actions on values.
➤ Arithmetic Operators ➕
let x = 10;
let y = 5;
console.log(x + y); // 15
console.log(x - y); // 5
console.log(x * y); // 50
console.log(x / y); // 2
console.log(x % y); // 0 (modulus: remainder) ➤ Assignment Operators 📝
let a = 5;
a += 3; // a = a + 3
console.log(a); // 8 Other examples:
➺ a-= 3 means a = a-3
➺a *=3 means a = a * 3
➺a /=3 means a= a /3
➺a %= 3 means a = a % 3
➤ Comparison Operators 🤔
Used to compare two values.
console.log(10 > 5); // true
console.log(10 < 5); // false
console.log(5 == "5"); // true (loose comparison)
console.log(5 === "5");// false (strict comparison) ➤ Logical Operators 🧠
let isSunny = true;
let hasUmbrella = false;
console.log(isSunny && hasUmbrella); // false
console.log(isSunny ||hasUmbrella); // true
console.log(!isSunny); // false 📝 4. Comments in JavaScript
Comments are not executed. They're for humans! 🧑🏫
➤ Single Line Comment
// This is a single-line comment
➤ Multi-line Comment
/* This is a multi-line comment. Used for longer explanations. */ 🎯 Real Life Example
Let's put it all together:
// Creating a user profile
let userName = "Selam";
let userAge = 22;
let isPremium = true;
let subscription = null;
console.log("Welcome " + userName); // Welcome Selam
console.log("Age in 5 years: " + (userAge + 5)); // Age in 5 years: 27
🎓 Summary
Today we learned:
✅ Primitive data types in JS
✅ How to convert types manually and automatically
✅ Arithmetic, logical, and comparison operators
✅ How to write comments for clarity
🙋🏾♀️ Dear Campers, make sure to experiment with these concepts in your browser or code editor! Open your DevTools, go to the Console tab, and play around 🧪
We’ll keep building one block at a time 🧱
Assignment
➺Arithmetic
https://youtu.be/FyGIKD2fxIo?si=SOZt293eYtSr83Qj
➺Data type conversion
https://youtu.be/jLRnuVHwHKk?si=29rO0jNlwb9aMxDe
➺Arithmetic
https://youtu.be/FyGIKD2fxIo?si=SOZt293eYtSr83Qj
➺Data type conversion
https://youtu.be/jLRnuVHwHKk?si=29rO0jNlwb9aMxDe
YouTube
JavaScript ARITHMETIC OPERATORS in 8 minutes! ➕
00:00:00 arithmetic operators
00:03:21 augmented assignment operators
00:04:54 increment/decrement operators
00:05:23 operator precedence
00:07:51 conclusion
// arithmetic operators = operands (values, variables, etc.)
// …
00:03:21 augmented assignment operators
00:04:54 increment/decrement operators
00:05:23 operator precedence
00:07:51 conclusion
// arithmetic operators = operands (values, variables, etc.)
// …
🔥🌡️ Week 3 Day 2 Challenge:
Temperature Converter
Your challenge today is to create a small temperature converter using JavaScript and the console. 🧠💻
🧾 What to Do
➡️ Write a small script that:
Takes a temperature value in Celsius.
Converts it to Fahrenheit using this formula:
Fahrenheit = (Celsius * 9/5) + 32
Then also does the reverse:
Convert Fahrenheit back to Celsius using:
Celsius = (Fahrenheit - 32) * 5/9
Print both results using console.log().
🧠 How to Do It (Step-by-Step Hints)
🟢 Use let to store your values:
🟢 Then try the reverse:
🔁 Bonus: Try changing the values to see different outputs.
✨Don’t forget to
➤➤SHARE your code with your group, ➤➤INVITE a friend to join the fun, and as always —
✌️ Stay warm, stay cool, stay coding, and a warm stay well! 💻❄️❤️
Temperature Converter
Your challenge today is to create a small temperature converter using JavaScript and the console. 🧠💻
🧾 What to Do
➡️ Write a small script that:
Takes a temperature value in Celsius.
Converts it to Fahrenheit using this formula:
Fahrenheit = (Celsius * 9/5) + 32
Then also does the reverse:
Convert Fahrenheit back to Celsius using:
Celsius = (Fahrenheit - 32) * 5/9
Print both results using console.log().
🧠 How to Do It (Step-by-Step Hints)
🟢 Use let to store your values:
let celsius = 30;
let fahrenheit = (celsius * 9/5) + 32;
console.log(celsius + "°C is " + fahrenheit + "°F"); 🟢 Then try the reverse:
let f = 86;
let c = (f - 32) * 5/9;
console.log(f + "°F is " + c + "°C");
🔁 Bonus: Try changing the values to see different outputs.
✨Don’t forget to
➤➤SHARE your code with your group, ➤➤INVITE a friend to join the fun, and as always —
✌️ Stay warm, stay cool, stay coding, and a warm stay well! 💻❄️❤️
Week 3, Day 3 JavaScript Lesson
👋 Hello, my amazing campers!
Welcome to Week 3, Day 3 of your JavaScript journey! 👩💻👨💻
Today’s lesson is all about making decisions in your code — just like how we make choices in real life.
Should you drink coffee or tea? Should the game say “Game Over” or “You Win”?
All of these are decisions we can write in code using something called conditionals and logical operators.
🧠 What You’ll Learn Today
We'll cover these topics in a deep, beginner-friendly way:
✅ Logical Operators (&&, ||, !)
✅ if / else Statements
✅ else if Chains
✅ Nested if Statements
1️⃣ Logical Operators in JavaScript
Logical operators are used to combine or modify conditions (true/false values). Think of them as tools that help JavaScript understand complex thinking.
✅ AND &&
👉 Both conditions must be true to run the code.
✅ OR ||
👉 Only one condition needs to be true.
✅ NOT !
Reverses the condition. If it's true, it becomes false , and vice versa.
👉 !isTired becomes true, so the message prints.
2️⃣ if / else Statements
This is the basic way to tell your program:
“If this is true, do that. Otherwise, do something else.”
Analogy: if it's sunny, you go out side. Else , you stay home.
✅ Syntax:
✅ Example:
3️⃣ else if Chains
What if you have more than two options?
Use else if to test multiple conditions!
✅ Example:
The program checks each condition from top to bottom, and runs the first one that’s true.
4️⃣ Nested if Statements
Sometimes, you need to check a condition inside another.
✅ Real-Life Example:
✅ Code Example:
🔁 This is called nesting because one if is inside another.
✅ Summary
Here’s what you just learned:
✅ &&, ||, ! — combine true/false values
✅ if / else — make a choice between two paths
✅ else if — multiple condition checks
✅ Nested if — one condition inside another
👀 Watch Out!
➤➤Always use === to compare values (not just =)
➤➤Curly braces {} are your friends! Keep them clear.
➤➤Be careful with nested ifs — too many layers can get confusing.
➤➤Indent your code properly to keep it readable!
👋 Hello, my amazing campers!
Welcome to Week 3, Day 3 of your JavaScript journey! 👩💻👨💻
Today’s lesson is all about making decisions in your code — just like how we make choices in real life.
Should you drink coffee or tea? Should the game say “Game Over” or “You Win”?
All of these are decisions we can write in code using something called conditionals and logical operators.
🧠 What You’ll Learn Today
We'll cover these topics in a deep, beginner-friendly way:
✅ Logical Operators (&&, ||, !)
✅ if / else Statements
✅ else if Chains
✅ Nested if Statements
1️⃣ Logical Operators in JavaScript
Logical operators are used to combine or modify conditions (true/false values). Think of them as tools that help JavaScript understand complex thinking.
✅ AND &&
👉 Both conditions must be true to run the code.
let isSunny = true;
let haveSunglasses = true;
if (isSunny && haveSunglasses) { console.log("Let's go to the beach! 🏖️"); } ✅ OR ||
👉 Only one condition needs to be true.
let hasMoney = false;
let hasCreditCard = true;
if (hasMoney || hasCreditCard) { console.log("You can buy the item 🛒"); } ✅ NOT !
Reverses the condition. If it's true, it becomes false , and vice versa.
let isTired = false;
if (!isTired) { console.log("You are ready to study! 💪"); } 👉 !isTired becomes true, so the message prints.
2️⃣ if / else Statements
This is the basic way to tell your program:
“If this is true, do that. Otherwise, do something else.”
Analogy: if it's sunny, you go out side. Else , you stay home.
✅ Syntax:
if (condition) { // runs if condition is true }
else { // runs if condition is false }
✅ Example:
let age = 18;
if (age >= 18) { console.log("You can vote 🗳️"); }
else { console.log("You are too young to vote ❌"); } 3️⃣ else if Chains
What if you have more than two options?
Use else if to test multiple conditions!
✅ Example:
let score = 85;
if (score >= 90) { console.log("Grade: A 🏅"); }
else if (score >= 80) { console.log("Grade: B 🎉"); }
else if (score >= 70) { console.log("Grade: C 🙂"); }
else { console.log("You need to study more 📚"); } The program checks each condition from top to bottom, and runs the first one that’s true.
4️⃣ Nested if Statements
Sometimes, you need to check a condition inside another.
✅ Real-Life Example:
If you are over 18, check if you have an ID.
If yes → allow entry.
If not → no entry.
If under 18 → no entry.
✅ Code Example:
let age = 20;
let hasID = false;
if (age >= 18) { if (hasID) { console.log("Welcome! 🎉"); } else { console.log("You need an ID to enter. 🪪"); } }
else { console.log("You are too young to enter. 🚫"); } 🔁 This is called nesting because one if is inside another.
✅ Summary
Here’s what you just learned:
✅ &&, ||, ! — combine true/false values
✅ if / else — make a choice between two paths
✅ else if — multiple condition checks
✅ Nested if — one condition inside another
👀 Watch Out!
➤➤Always use === to compare values (not just =)
➤➤Curly braces {} are your friends! Keep them clear.
➤➤Be careful with nested ifs — too many layers can get confusing.
➤➤Indent your code properly to keep it readable!
Week 3 Day 3 Challenge time!
Hey Campers ✌️
You've been doing an awesome job learning how JavaScript makes decisions using if, else, and logical operators like &&, ||, and !. Today, it's time to put your logic into action — through a fun mini project! 🎯✨
🧪 Today’s Challenge: Pick One and Code It 🧠
We’re giving you three fun real-life inspired problems — choose any one and try to solve it using variables + if/else logic.
✅ Option 1: Grade Evaluator 📊
Goal: Write a program that stores a student's score in a variable and tells the grade.
📌 Example:
📌 Output:
🧠 Grade Range:
90–100 → A
80–89 → B
70–79 → C
60–69 → D
Below 60 → F
✅ Option 2: Login Checker 🔐
Goal: Write a program that checks login credentials.
📌 Example:
📌 Output:
🧠 Expected Behavior:
If both match → "Welcome!"
If one is wrong → tell which one
If both are wrong → "Access denied"
✅ Option 3: Restaurant Menu Chooser 🍽️
Goal: Show menu based on time of day.
📌 Example:
📌 Output:
🧠 Time Options:
"morning" → breakfast
"afternoon" → lunch
"evening" → dinner
anything else → kitchen closed
🎯 Pick ONE of the three
Write your code clearly with good variable names and use console.log() to show messages. You already have everything you need!
📣 Don’t forget campers:
💬 Share your solution in the group
📩 Invite your friends to learn together
🧡✌️ Stay curious, stay well, and keep coding!
Hey Campers ✌️
You've been doing an awesome job learning how JavaScript makes decisions using if, else, and logical operators like &&, ||, and !. Today, it's time to put your logic into action — through a fun mini project! 🎯✨
🧪 Today’s Challenge: Pick One and Code It 🧠
We’re giving you three fun real-life inspired problems — choose any one and try to solve it using variables + if/else logic.
✅ Option 1: Grade Evaluator 📊
Goal: Write a program that stores a student's score in a variable and tells the grade.
📌 Example:
let score = 82; 📌 Output:
"Your grade is: B" 🧠 Grade Range:
90–100 → A
80–89 → B
70–79 → C
60–69 → D
Below 60 → F
✅ Option 2: Login Checker 🔐
Goal: Write a program that checks login credentials.
📌 Example:
let correctUsername = "camper";
let correctPassword = "12345";
let username = "camper";
let password = "12345"; 📌 Output:
"Welcome, camper!" 🧠 Expected Behavior:
If both match → "Welcome!"
If one is wrong → tell which one
If both are wrong → "Access denied"
✅ Option 3: Restaurant Menu Chooser 🍽️
Goal: Show menu based on time of day.
📌 Example:
let timeOfDay = "evening"; 📌 Output:
“Dinner menu coming up!” 🧠 Time Options:
"morning" → breakfast
"afternoon" → lunch
"evening" → dinner
anything else → kitchen closed
🎯 Pick ONE of the three
Write your code clearly with good variable names and use console.log() to show messages. You already have everything you need!
📣 Don’t forget campers:
💬 Share your solution in the group
📩 Invite your friends to learn together
🧡✌️ Stay curious, stay well, and keep coding!
Week 3 Day 4 JavaScript Lesson:
🎉 Hey wonderful campers!
Welcome to Week 3, Day 4 of our exciting JavaScript journey! 🌍✨
We’re now stepping deeper into the world of interactivity and logic—where our code starts talking to users and making decisions repeatedly. 😮
So, buckle up, get comfy, and let’s learn some real coding superpowers today! 🚀💻
🧾 Today’s Lesson Outline:
✅ 1. alert() – Show Messages to the User
✅ 2. What is a Loop? Why do We Need It?
✅ 3. while Loop
✅ 4. do...while Loop
✅ 5. break and continue
✅ 6. Combining Loops with if Statements
🗨️ 1. alert() — Pop-up Messages 💬
🔹 What is alert()?
alert() is a built-in JavaScript function that shows a pop-up box with a message. It’s a simple way to talk to the user.
🧠 Analogy:
Imagine knocking on someone’s door and shouting something through the window — you don’t wait for an answer, just say it and leave. That’s alert()! 💬🚪
🧪 More Examples:
You can use alert() to show results to users like:
➤➤Converted temperatures 🌡️
➤➤Final grades 📝
➤➤Confirmation messages ✅
🔁 2. What is a Loop? Why Do We Need It?
Sometimes we need to do the same task many times.
🧠 Analogy:
Imagine you want to clap your hands 10 times 👏. You could write:
But that’s tiring and repetitive. Instead, we use a loop!
A loop is like saying:
🔄 3. while Loop – Repeat While a Condition is True
🧾 Syntax:
💡 Example:
🧠 Explanation:
The loop starts with count = 1.
It checks count <= 5 — if true, it runs the block.
count++ increases count by 1.
When count becomes 6, the condition is false, and the loop stops.
🚨 Infinite Loop Warning!
If you forget to change the condition, it will run forever!
✨ Real-Life Example:
🔁 4. do...while Loop — Run First, Then Check
🔹 Syntax:
💡 Example:
📌 Difference from while:
do...while runs the code at least once, even if the condition is false!
🧨 5. break and continue in Loops
✅ break — Stop the loop early
🧠 Use break when you want to escape a loop.
✅ continue — Skip one round, continue with the rest
📌 Use continue to skip a step inside the loop.
🔗 6. Using if Inside Loops 💡
You can combine loops and conditions!
💡 Example 1: Print even numbers only
💡 Example 2: Countdown with alert
🧠 Summary for Today
You learned how to:
✅Use alert() to communicate with the user
✅Create loops with while and do...while
✅Break out or skip parts of a loop with break and continue
✅Combine loops with conditions to write smart, repeating code
🎉 Hey wonderful campers!
Welcome to Week 3, Day 4 of our exciting JavaScript journey! 🌍✨
We’re now stepping deeper into the world of interactivity and logic—where our code starts talking to users and making decisions repeatedly. 😮
So, buckle up, get comfy, and let’s learn some real coding superpowers today! 🚀💻
🧾 Today’s Lesson Outline:
✅ 1. alert() – Show Messages to the User
✅ 2. What is a Loop? Why do We Need It?
✅ 3. while Loop
✅ 4. do...while Loop
✅ 5. break and continue
✅ 6. Combining Loops with if Statements
🗨️ 1. alert() — Pop-up Messages 💬
🔹 What is alert()?
alert() is a built-in JavaScript function that shows a pop-up box with a message. It’s a simple way to talk to the user.
alert("Hello, Campers! Welcome to JavaScript!"); 🧠 Analogy:
Imagine knocking on someone’s door and shouting something through the window — you don’t wait for an answer, just say it and leave. That’s alert()! 💬🚪
🧪 More Examples:
let name = "Kebede";
alert("Hi " + name + ", welcome to the camp! 😎");let score = 95;
alert("Your score is: " + score);
You can use alert() to show results to users like:
➤➤Converted temperatures 🌡️
➤➤Final grades 📝
➤➤Confirmation messages ✅
🔁 2. What is a Loop? Why Do We Need It?
Sometimes we need to do the same task many times.
🧠 Analogy:
Imagine you want to clap your hands 10 times 👏. You could write:
console.log("Clap!"); console.log("Clap!"); console.log("Clap!"); ... But that’s tiring and repetitive. Instead, we use a loop!
A loop is like saying:
"As long as this condition is true, keep repeating this code."
🔄 3. while Loop – Repeat While a Condition is True
🧾 Syntax:
while (condition) { // code to run } 💡 Example:
let count = 1;
while (count <= 5) { console.log("Count is: " + count); count++; }🧠 Explanation:
The loop starts with count = 1.
It checks count <= 5 — if true, it runs the block.
count++ increases count by 1.
When count becomes 6, the condition is false, and the loop stops.
🚨 Infinite Loop Warning!
If you forget to change the condition, it will run forever!
let i = 1; while (i <= 5)
{ console.log("This will never stop 😨"); // missing i++ }
✨ Real-Life Example:
let bottles = 3;
while (bottles > 0) { alert("Drink a bottle. " + bottles + " left."); bottles--; }
🔁 4. do...while Loop — Run First, Then Check
🔹 Syntax:
do { // code to run } while (condition); 💡 Example:
let x = 1;
do { console.log("x is: " + x); x++; } while (x <= 3); 📌 Difference from while:
do...while runs the code at least once, even if the condition is false!
let y = 10;
do { console.log("This runs once even if y > 5"); } while (y < 5); 🧨 5. break and continue in Loops
✅ break — Stop the loop early
let num = 1;
while (num <= 10) { if (num === 5) { break; // stops when num is 5 }
console.log("Number: " + num); num++; } 🧠 Use break when you want to escape a loop.
✅ continue — Skip one round, continue with the rest
let n = 0;
while (n < 5) { n++; if (n === 3) { continue; // skips 3 }
console.log(n); // prints 1, 2, 4, 5 } 📌 Use continue to skip a step inside the loop.
🔗 6. Using if Inside Loops 💡
You can combine loops and conditions!
💡 Example 1: Print even numbers only
let i = 1;
while (i <= 10) { if (i % 2 === 0) { console.log(i + " is even"); } i++; } 💡 Example 2: Countdown with alert
let seconds = 5;
while (seconds > 0) { alert("⏳ Time left: " + seconds + " seconds"); seconds--; }
alert("⏰ Time's up!"); 🧠 Summary for Today
You learned how to:
✅Use alert() to communicate with the user
✅Create loops with while and do...while
✅Break out or skip parts of a loop with break and continue
✅Combine loops with conditions to write smart, repeating code
🚀 Today’s JavaScript Challenge (Week 3 Day 4)
To help you practice what you’ve learned, here are 4 awesome mini-challenges.
👉 Choose any 2 that you like and give them a try!
💡 1) Skip 7 from 1–20
Print all numbers from 1 to 20, but skip number 7. 😎
Hint:
Use a while or do...while loop. Inside the loop, use an if condition.
💡 2) Multiples of 3 (from 1 to 30)
Print all numbers from 1 to 30 that are divisible by 3.
Hint:
Use number % 3 === 0 to check.
💡 3) Even or Odd Checker
Print numbers from 1 to 15. For each number, print whether it's "Even" or "Odd".
Hint:
Use if (number % 2 === 0) to check even. Else, it’s odd!
💡 4) FizzBuzz Lite
Print numbers from 1 to 20.
But:
➤If the number is divisible by 3 → print “Fizz”
➤If divisible by 5 → print “Buzz”
➤If divisible by both → print “FizzBuzz”
➤Otherwise, print the number itself.
Hint:
Use if...else if...else, and remember to check the both divisible condition first!
🧠 Pick 2 Challenges Only
Don’t stress. Choose any two, and write the code in your code editor. Try to understand the logic step by step — it’s okay to make mistakes!
💌 As Always
👉 Share your progress with the group
👉 Invite your friends to join our fun journey
👉 And most importantly, stay coding, stay curious, and stay well! ✌️💻💙
To help you practice what you’ve learned, here are 4 awesome mini-challenges.
👉 Choose any 2 that you like and give them a try!
💡 1) Skip 7 from 1–20
Print all numbers from 1 to 20, but skip number 7. 😎
Hint:
Use a while or do...while loop. Inside the loop, use an if condition.
💡 2) Multiples of 3 (from 1 to 30)
Print all numbers from 1 to 30 that are divisible by 3.
Hint:
Use number % 3 === 0 to check.
💡 3) Even or Odd Checker
Print numbers from 1 to 15. For each number, print whether it's "Even" or "Odd".
Hint:
Use if (number % 2 === 0) to check even. Else, it’s odd!
💡 4) FizzBuzz Lite
Print numbers from 1 to 20.
But:
➤If the number is divisible by 3 → print “Fizz”
➤If divisible by 5 → print “Buzz”
➤If divisible by both → print “FizzBuzz”
➤Otherwise, print the number itself.
Hint:
Use if...else if...else, and remember to check the both divisible condition first!
🧠 Pick 2 Challenges Only
Don’t stress. Choose any two, and write the code in your code editor. Try to understand the logic step by step — it’s okay to make mistakes!
💌 As Always
👉 Share your progress with the group
👉 Invite your friends to join our fun journey
👉 And most importantly, stay coding, stay curious, and stay well! ✌️💻💙
❤1
Forwarded from Birhan Nega
How to keep focused while coding
Here are some tips to help you focus on coding:
1. Eliminate distractions: Find a quiet place to work and turn off any notifications or alerts that might interrupt your concentration.
2. Set goals: Break down your coding tasks into smaller, achievable goals. This will help you stay focused and motivated.
3. Take breaks: It's important to take regular breaks to avoid burnout and maintain your focus. Try the Pomodoro technique, which involves working for 25 minutes and taking a 5-minute break.
4. Use a timer: Set a timer for a specific amount of time and work on your coding task until the timer goes off. This will help you stay focused and avoid procrastination.
5. Stay organized: Keep your workspace and code organized to avoid distractions and make it easier to focus on your coding tasks.
6. Practice mindfulness: Take a few deep breaths and focus on the present moment before starting your coding task. This can help you clear your mind and improve your focus.
Here are some tips to help you focus on coding:
1. Eliminate distractions: Find a quiet place to work and turn off any notifications or alerts that might interrupt your concentration.
2. Set goals: Break down your coding tasks into smaller, achievable goals. This will help you stay focused and motivated.
3. Take breaks: It's important to take regular breaks to avoid burnout and maintain your focus. Try the Pomodoro technique, which involves working for 25 minutes and taking a 5-minute break.
4. Use a timer: Set a timer for a specific amount of time and work on your coding task until the timer goes off. This will help you stay focused and avoid procrastination.
5. Stay organized: Keep your workspace and code organized to avoid distractions and make it easier to focus on your coding tasks.
6. Practice mindfulness: Take a few deep breaths and focus on the present moment before starting your coding task. This can help you clear your mind and improve your focus.
Week 3 Day 5 JavaScript Lesson :
👋 Hello Campers!
Welcome to Week 3 Day 5!
Today, we’re going to learn two big skills:
📥 1. How to get input from the user
🔁 2. How to repeat code using a for loop
These two work together like a perfect duo—like asking someone their name (input) and greeting them multiple times (loop).
Let’s go step by step 💪.
🧠 1. Getting Input from the User in JavaScript
👂 What is "input"?
When you want the user to give something to your program—like their name, age, or favorite color—you ask them a question and store the answer.
In JavaScript (in the browser), we use:
This opens a small popup asking the user to type something.
🧪 Example 1: Ask for their name
✅ When this runs, the user will see a box.
They can type “Liya”, and the output will be:
🔒 Important: Where does prompt() work?
It only works in the browser, not in Node.js or many online compilers.
So try it in the browser’s console (Right click → Inspect → Console tab).
🧪 Example 2: Get two numbers and add them
📌 Number() is used because prompt() gives us text (called a "string").
We change it into a number so we can do math.
🔄 Analogy: Getting input is like giving your friend a paper form 📝
➤➤You ask: “What's your name?”
➤➤They fill it and hand it back.
You:
➤
➤Your friend writes “Sam” and hands it back. Now name = "Sam".
🔁 2. The for Loop – Repeating Code
Let’s now learn how to repeat something multiple times using the for loop.
🧠 Syntax of a for loop:
Here’s what that means:
➤start → where to begin (usually let i = 0)
➤condition → how long to keep looping (like i < 5)
➤step → how to move each time (like i++ to add 1)
🧪 Example 1: Print numbers 1 to 5
Output:
🧪 Example 2: Print "Hi" 3 times
🧪 Example 3: Ask the user how many times to repeat something
Let’s use prompt() + for together.
🧪 Example 4: Say "Even" or "Odd" for each number
🧪 Example 5: Skip number 3 using continue
Output:
🧪 Example 6: Stop the loop early using break
Output:
🧠 Summary
Today, you learned:
✅ How to use prompt() to get input from the user
✅ How to use for loops to repeat actions
✅ How to mix loops with conditions
✅ How to use break and continue
👋 Hello Campers!
Welcome to Week 3 Day 5!
Today, we’re going to learn two big skills:
📥 1. How to get input from the user
🔁 2. How to repeat code using a for loop
These two work together like a perfect duo—like asking someone their name (input) and greeting them multiple times (loop).
Let’s go step by step 💪.
🧠 1. Getting Input from the User in JavaScript
👂 What is "input"?
When you want the user to give something to your program—like their name, age, or favorite color—you ask them a question and store the answer.
In JavaScript (in the browser), we use:
prompt("Your question here") This opens a small popup asking the user to type something.
🧪 Example 1: Ask for their name
let name = prompt("What's your name?");
console.log("Hello, " + name + "!"); ✅ When this runs, the user will see a box.
They can type “Liya”, and the output will be:
Hello, Liya! 🔒 Important: Where does prompt() work?
It only works in the browser, not in Node.js or many online compilers.
So try it in the browser’s console (Right click → Inspect → Console tab).
🧪 Example 2: Get two numbers and add them
let num1 = prompt("Enter first number:");
let num2 = prompt("Enter second number:");
let sum = Number(num1) + Number(num2);
console.log("The sum is: " + sum);
📌 Number() is used because prompt() gives us text (called a "string").
We change it into a number so we can do math.
🔄 Analogy: Getting input is like giving your friend a paper form 📝
➤➤You ask: “What's your name?”
➤➤They fill it and hand it back.
You:
➤
let name = prompt("What's your name?"); ➤Your friend writes “Sam” and hands it back. Now name = "Sam".
🔁 2. The for Loop – Repeating Code
Let’s now learn how to repeat something multiple times using the for loop.
🧠 Syntax of a for loop:
for (start; condition; step) { // code to repeat } Here’s what that means:
➤start → where to begin (usually let i = 0)
➤condition → how long to keep looping (like i < 5)
➤step → how to move each time (like i++ to add 1)
🧪 Example 1: Print numbers 1 to 5
for (let i = 1; i <= 5; i++) { console.log(i); } Output:
1 2 3 4 5 🧪 Example 2: Print "Hi" 3 times
for (let i = 0; i < 3; i++) { console.log("Hi"); }
🧪 Example 3: Ask the user how many times to repeat something
Let’s use prompt() + for together.
let times = prompt("How many stars do you want?");
times = Number(times);
for (let i = 1; i <= times; i++) { console.log("⭐ Star " + i); } 🧪 Example 4: Say "Even" or "Odd" for each number
for (let i = 1; i <= 5; i++) {
if (i % 2 === 0) { console.log(i + " is even"); }
else { console.log(i + " is odd"); } } 🧪 Example 5: Skip number 3 using continue
for (let i = 1; i <= 5; i++) {
if (i === 3) { continue; }
console.log(i); } Output:
1 2 4 5 🧪 Example 6: Stop the loop early using break
for (let i = 1; i <= 5; i++) {
if (i === 4) { break; }
console.log(i); } Output:
1 2 3 🧠 Summary
Today, you learned:
✅ How to use prompt() to get input from the user
✅ How to use for loops to repeat actions
✅ How to mix loops with conditions
✅ How to use break and continue
❤1