chore(i18n): sync translations with latest source changes (chunk 12/14, 100 files)

pull/1668/head
localizeflow[bot] 1 month ago
parent 4967802566
commit 05bab63d1e

@ -0,0 +1,64 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "0aaa930f076f2d83cc872ad157f8ffd3",
"translation_date": "2026-01-08T20:45:40+00:00",
"source_file": "9-chat-project/solution/backend/python/README.md",
"language_code": "ml"
}
-->
# കോഡ് 실행ിക്കുക
## ക്രമീകരിക്കുക
വര്‍ച്ച്വല്‍ പരിതസ്ഥിതി സൃഷ്ടിക്കുക
```sh
python -m venv venv
source ./venv/bin/activate
```
## ആശ്രിതങ്ങള്‍ ഇന്‍സ്റ്റാള്‍ ചെയ്യുക
```sh
pip install openai fastapi uvicorn python-dotenv
```
## API 실행ിക്കുക
```sh
# രീതി 1: നേരിട്ട് പ്രവർത്തനങ്ങൾ
python api.py
# രീതി 2: uvicorn ഉപയോഗിച്ച്
uvicorn api:app --host 0.0.0.0 --port 5000 --reload
```
## API പരീക്ഷിക്കുക
ഇന്ററാക്ടീവായ API ഡോക്യുമെന്റേഷന് സഞ്ചരിക്കുക: `http://localhost:5000/docs`
## ഫ്രണ്ട്എന്‍ഡ് 실행ിക്കുക
ഫ്രണ്ട്എന്‍ഡ് ഫോള്‍ഡറിലുള്ളത് ഉറപ്പാക്കുക
*app.js* ഫയല്‍ കണ്ടെത്തുക, `BASE_URL` നിങ്ങളുടെ ബാക്ക്‌എന്‍ഡ് URL ആയി മാറ്റുക
ഇത് 실행ിക്കുക
```
npx http-server -p 8000
```
ചാറ്റില്‍ ഒരു സന്ദേശം ടൈപ്പ് ചെയ്ത് നോക്കൂ, നിങ്ങൾക്ക് ഒരു പ്രതികരണം കാണാം (നിങ്ങൾ ഇത് Codespace-ൽ 실행ിക്കുന്നയാൾ ആണെങ്കിൽ അല്ലെങ്കിൽ അപസ്‌സസ് ടോക്കൺ ക്രമീകരിച്ചിട്ടുണ്ടെങ്കിൽ).
## അപസ്‌സസ് ടോക്കൺ ക്രമീകരിക്കുക (നിങ്ങൾ ഇത് Codespace-ൽ 실행ിക്കുകയില്ലെങ്കിൽ)
[Set up PAT](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens) കാണുക
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**അസൂചനം**:
ഈ രേഖ AI പരിഭാഷ സേവനം [Co-op Translator](https://github.com/Azure/co-op-translator) ഉപയോഗിച്ച് പരിഭാഷ ചെയ്തതാണ്. നാം ശരിയായ പരിഭാഷയ്ക്ക് ശ്രമിക്കുന്നുവെങ്കിലും, ഓട്ടോമാറ്റിക് പരിഭാഷകളിൽ പിഴവുകൾ അല്ലെങ്കിൽ അപൂർവതകൾ ഉണ്ടാകാവുന്നതാണ്. മാതൃഭാഷയിലുള്ള യഥാർത്ഥ രേഖയെ ഔദ്യോഗിക ഉറവിടമായി കരുതണം. അത്യന്താപേക്ഷിത വിവരങ്ങൾക്ക് പ്രൊഫഷണൽ മനുഷ്യ പരിഭാഷ ശിപാർശ ചെയ്യുന്നു. ഈ പരിഭാഷയുടെ ഉപയോഗത്തിൽ നിന്നുള്ള യാതൊരു തെറ്റ്മോ അർത്ഥം തെറ്റിച്ചോ സംഭവിക്കുന്ന ഒരു പിഴവിനും ഞങ്ങൾ ഉത്തരവാദികളല്ല.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,23 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "7746a470be8fc7f736eb1b43ebb710ee",
"translation_date": "2026-01-08T20:39:25+00:00",
"source_file": "9-chat-project/solution/frontend/README.md",
"language_code": "ml"
}
-->
# കോഡ് 실행 කරන්න
```sh
npx http-server -p 3000
```
`app.js`-ൽ `BASE_URL` കണ്ടെത്തി അത് ബാക്ക്‌എൻഡ് URL-ന് അനുയോജ്യമായി മാറ്റുക.
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**അസ്വീകാരം**:
ഈ ഡോക്യുമെന്റ് AI പരിഭാഷാ സേവനം [Co-op Translator](https://github.com/Azure/co-op-translator) ഉപയോഗിച്ച് പരിഭാഷപ്പെടുത്തപ്പെട്ടതാണ്. നമുക്ക് കൃത്യതയ്ക്കായി ശ്രമിച്ചുകയറവൻമാത്രവുമല്ല, സ്വയം പ്രവർത്തിക്കുന്ന പരിഭാഷകളിൽ പിശകുകളും തെറ്റുകളും ഉണ്ടാകാമെന്നാണ് കരുതേണ്ടത്. ഉയർന്ന പ്രാധാന്യമുള്ള വിവരങ്ങൾക്ക് മേൽ സ്വദേശഭാഷയിലുള്ള ഒറിജിനൽ ഡോക്യുമെന്റ് അടിസ്ഥാനഗതമായ കണക്കെടുക്കേണ്ടതാണ്. അത്യന്താപേക്ഷിതമായ വിവരങ്ങൾക്ക് പ്രൊഫഷണൽ മനുഷ്യ പരിഭാഷ ശിപാർശ ചെയ്യുന്നു. ഈ പരിഭാഷ ഉപയോഗിക്കുന്നത് മൂലം ഉണ്ടാകാവുന്ന തെറ്റായ വ്യാഖ്യാനങ്ങൾക്കോ, പരസ്പരാർത്ഥം വഴമുടക്കങ്ങൾക്കോ ഞങ്ങൾ ഉത്തരവാദികളാകുന്നില്ല.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,417 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "a362efd06d64d4134a0cfe8515a86d34",
"translation_date": "2026-01-08T10:26:00+00:00",
"source_file": "AGENTS.md",
"language_code": "ml"
}
-->
# AGENTS.md
## Project Overview
ഇത് വെബ് വികസനത്തിന്റെ അടിസ്ഥാനങ്ങളെ തുടക്കക്കാരെ പഠിപ്പിക്കുന്നതിനുള്ള ഒരു വിദ്യാഭ്യാസ പാഠ്യപദ്ധതി റെപ്പോസിറ്ററിയാണ്. മൈക്രോസോഫ്റ്റ് ക്ലൗഡ് അഡ്വക്കേറ്റുകൾ വികസിപ്പിച്ചെടുത്ത 12 ആഴ്ചകളിലെ സമഗ്ര കോഴ്സ് ആണ് ഈ പാഠ്യപദ്ധതി, അതിൽ ജാവാസ്ക്രിപ്റ്റ്, CSS, HTML തുടങ്ങിയ വിഷയങ്ങളെക്കുറിച്ചുള്ള 24 പ്രായോഗിക പാഠങ്ങൾ ഉൾക്കൊള്ളുന്നു.
### Key Components
- **വിദ്യാഭ്യാസ ഉള്ളടക്കം**: പദ്ധതിപരമായി ക്രമീകരിച്ച 24 ഘടനാപരമായ പാഠങ്ങൾ
- **പ്രായോഗിക പ്രോജക്ടുകൾ**: Terrarium, ടൈപ്പിങ്ങ് ഗെയിം, ബ്രൗസർ എക്സ്‌ടൻഷൻ, സ്പേസ് ഗെയിം, ബാങ്കിംഗ് ആപ്പ്, കോഡ് എഡിറ്റർ, AI ചാറ്റ് അസിസ്റ്റന്റ്
- **ഇന്ററാക്ടീവ് ക്വിസുകൾ**: ഓരോത്തിലും 3 ചോദ്യങ്ങളുള്ള 48 ക്വിസുകൾ (പാഠം മുമ്പും ശേഷവും)
- **ബഹുഭാഷാ പിന്തുണ**: GitHub Actions ഉപയോഗിച്ച് 50+ ഭാഷകളിലേക്ക് സ്വಯമാറ്റം
- **ടെക്‌നോളജികൾ**: HTML, CSS, ജാവാസ്ക്രിപ്റ്റ്, Vue.js 3, Vite, Node.js, Express, Python (AI പ്രോജക്ടുകൾക്ക്)
### Architecture
- പാഠം അധിഷ്ഠിത ഘടനയോടെ വിദ്യാഭ്യാസ റെപ്പോസിറ്ററി
- ഓരോ പാഠ ഫോളഡറിൽ README, കോഡ് ഉദാഹരണങ്ങൾ, പരിഹാരങ്ങൾ അടങ്ങിയിരിക്കുന്നു
- സ്വതന്ത്ര പ്രോജക്ടുകൾ വേർതിരിച്ച ഫോളഡറുകളിൽ (quiz-app, വ്യത്യസ്ത പാഠ പ്രോജക്ടുകൾ)
- GitHub Actions ഉപയോഗിച്ചുള്ള വിവർത്തന സംവിധാനം (co-op-translator)
- ഡോക്യൂമെന്റേഷൻ Docsify വഴി സർവ് ചെയ്യുന്നു കൂടാതെ PDF രൂപത്തിൽ ലഭ്യമാണ്
## Setup Commands
ഈ റെപ്പോസിറ്ററി പ്രധാനമായും വിദ്യാഭ്യാസ ഉള്ളടക്കം ഉപയോഗിക്കാൻ ആണ്. പ്രത്യേക പ്രോജക്ടുകൾ ഉപയോഗിക്കാൻ:
### Main Repository Setup
```bash
git clone https://github.com/microsoft/Web-Dev-For-Beginners.git
cd Web-Dev-For-Beginners
```
### Quiz App Setup (Vue 3 + Vite)
```bash
cd quiz-app
npm install
npm run dev # ഡെവലപ്പ്മെന്റ് സർവർ തുടങ്ങിയ്ക്കുക
npm run build # പ്രൊഡക്ഷനായി നിർമ്മിക്കുക
npm run lint # ESLint ഓടിക്കൂ
```
### Bank Project API (Node.js + Express)
```bash
cd 7-bank-project/api
npm install
npm start # എപി‌ഐ സര്‍വര്‍ ആരംഭിക്കുക
npm run lint # ഇഎസ്എലിന്‍റ് ഓടിക്കുക
npm run format # പ്രിസ്റ്റിയറോടെ ഫോര്‍മാറ്റ് ചെയ്യുക
```
### Browser Extension Projects
```bash
cd 5-browser-extension/solution
npm install
# ബ്രൗസര്‍-സവിശേഷമായ എക്‌സ്‌ടന്‍ഷന്‍ ലോഡിംഗ് നിർദ്ദേശങ്ങൾ പിന്തുടരുക
```
### Space Game Projects
```bash
cd 6-space-game/solution
npm install
# ബ്രൗസറിൽ index.html തുറക്കുക അല്ലെങ്കിൽ ലൈവ് സർവർ ഉപയോഗിക്കുക
```
### Chat Project (Python Backend)
```bash
cd 9-chat-project/solution/backend/python
pip install openai
# GITHUB_TOKEN പരിസ്ഥിതി സ്വഭാവിക ഘടകമായി സജ്ജമാക്കുക
python api.py
```
## Development Workflow
### For Content Contributors
1. നിങ്ങളുടെ GitHub അക്കൗണ്ടിൽ റെപ്പോസിറ്ററി **ഫോർക്ക് ചെയ്യുക**
2. നിങ്ങളുടെ ഫോർക്ക് ലൊക്കലായി **ക്ലോൺ ചെയ്യുക**
3. നിങ്ങളുടെ മാറ്റങ്ങൾക്കായി **പുതിയ ബ്രാഞ്ച് സൃഷ്ടിക്കുക**
4. പാഠ ഉള്ളടക്കം അല്ലെങ്കിൽ കോഡ് ഉദാഹരണങ്ങളിൽ മാറ്റങ്ങൾ വരുത്തുക
5. ബന്ധപ്പെട്ട പ്രോജക്ട് ഡയറക്ടറികളിൽ കോഡ് മാറ്റങ്ങൾ പരിശോധന നടത്തുക
6. കൺട്രിബ്യൂഷൻ മാർഗനിർദേശങ്ങൾ പാലിച്ച് പുൾ റിക്വസ്റ്റുകൾ സമർപ്പിക്കുക
### For Learners
1. റെപ്പോസിറ്ററി ഫോർക്ക് ചെയ്യുകയോ ക്ലോൺ ചെയ്യുകയോ ചെയ്യുക
2. പാഠ ഡയറക്ടറികളിലേക്ക് ക്രമാശ്രിതമായി പോകുക
3. ഓരോ പാഠത്തിനും README ഫയലുകൾ വായിക്കുക
4. https://ff-quizzes.netlify.app/web/ ൽ പാഠത്തിനു മുമ്പുള്ള ക്വിസുകൾ പൂർത്തിയാക്കുക
5. പാഠ ഫോളഡറുകളിൽ കോഡ് ഉദാഹരണങ്ങൽ പാസാക്കുക
6. അസൈൻമെന്റുകളും കൂടുതൽ ചൈലഞ്ചുകളും പൂർത്തിയാക്കുക
7. പാഠത്തിനു ശേഷമുള്ള ക്വിസുകൾ എടുക്കുക
### Live Development
- **ഡോക്യൂമെന്റേഷൻ**: റൂട്ടിൽ `docsify serve` ഓടിക്കുക (പോർട്ട് 3000)
- **Quiz App**: quiz-app ഡയറക്ടറിയിൽ `npm run dev` ഓടിക്കുക
- **പ്രോജക്ടുകൾ**: HTML പ്രോജക്ടുകൾക്ക് VS Code Live Server എക്സ്റ്റെൻഷൻ ഉപയോഗിക്കുക
- **API Projects**:​អതിരേഷമുള്ള API ഡയറക്ടറികളിൽ `npm start` ഓടിക്കുക
## Testing Instructions
### Quiz App Testing
```bash
cd quiz-app
npm run lint # കോഡ് സ്റ്റൈൽ പ്രശ്‌നങ്ങൾ പരിശോധിക്കുക
npm run build # ബിൽഡ് വിജയിക്കുന്നത് സ്ഥിരീകരിക്കുക
```
### Bank API Testing
```bash
cd 7-bank-project/api
npm run lint # കോഡ് സ്റ്റൈൽ പ്രശ്നങ്ങൾ പരിശോധിക്കുക
node server.js # പിഴവുകൾ ഇല്ലാതെ സെർവർ തുടങ്ങുന്നത് സ്ഥിരീകരിക്കുക
```
### General Testing Approach
- ഇത് സമഗ്രമായ സ്വയംപരീക്ഷണ പരീക്ഷണങ്ങളില്ലാത്തൊരു വിദ്യാഭ്യാസ റെപ്പോസിറ്ററിയാണ്
- മാനുവൽ ടെസ്റ്റിംഗിന്റെ പ്രധാന ലക്ഷ്യം:
- കോഡ് ഉദാഹരണങ്ങൾ പിശക് രഹിതമായ പ്രവർത്തനം
- ഡോക്യുമെന്റേഷൻ ലിങ്കുകൾ ശരിയായ പ്രവർത്തനം
- പ്രോജക്ട് ബിൽഡുകൾ പൂര്‍ണ്ണത
- ഉദാഹരണങ്ങൾ മികച്ച അനുഭവരീതികൾ പാലിക്കുന്നു
### Pre-submission Checks
- package.json അടങ്ങിയ ഡയറക്ടറികളിൽ `npm run lint` ഓടിക്കുക
- മാർക്ക്ഡൗൺ ലിങ്കുകൾ സാധുവാണെന്ന് പരിശോധിക്കുക
- ബ്രൗസറിലോ Node.js-ലോ കോഡ് ഉദാഹരണങ്ങൾ പരീക്ഷിക്കുക
- വിവർത്തനങ്ങളുടെ ഘടന കൃത്യമായി നിലനിൽക്കുന്നു എന്ന് ഉറപ്പാക്കുക
## Code Style Guidelines
### JavaScript
- ആധുനിക ES6+ ലിപി ഉപയോഗിക്കുക
- പ്രോജക്ടുകളിൽ ലഭ്യമായ സാധാരണ ESLint കോൺഫിഗറേഷനുകൾ പാലിക്കുക
- വിദ്യാർത്ഥികൾക്ക് മനസ്സിലാക്കാൻ സാധിക്കുന്ന രീതിയിൽ നാമങ്ങൾ ഉപയോഗിക്കുക
- ആശയങ്ങൾ വിശദീകരിക്കുന്ന കുറിപ്പുകൾ ചേർക്കുക
- Prettier ഉപയോഗിച്ച് സജ്ജമാക്കിയ സ്ഥലങ്ങളിൽ ഫോർമാറ്റ് ചെയ്യുക
### HTML/CSS
- സേമാന്റിക് HTML5 ഘടകങ്ങൾ
- പ്രതികരണാത്മക ഡിസൈൻ സിദ്ധാന്തങ്ങൾ
- സ്പష్టం ക്ലാസ് നാമകരണ പാട്
- വിദ്യാർത്ഥികൾക്ക് സഹായകമായ CSS സാങ്കേതികത വിശദീകരിക്കുന്ന കുറിപ്പുകൾ
### Python
- PEP 8 ശൈലി മാർഗനിർദേശങ്ങൾ
- വ്യക്തവും പഠനാർത്ഥകവുമായ കോഡ് ഉദാഹരണങ്ങൾ
- പഠനത്തിന് സഹായകരമായ ടൈപ്പ് നിർദ്ദേശങ്ങൾ
### Markdown Documentation
- വ്യക്തമായ തലശ്രീനി ക്രമീകരണം
- ഭാഷ നിർദേശങ്ങളോടുകൂടിയ കോഡ് ബ്ലോക്കുകൾ
- അധിക വിഭവങ്ങളുടെ ലിങ്കുകൾ
- `images/` ഡയറക്ടറികളിൽ സ്‌ക്രീൻഷോട്ടുകളും ചിത്രങ്ങളും
- ആക്സസിബിലിറ്റിക്ക് ചിത്രം മാറ്റിനോട്ടുകൾ
### File Organization
- പാഠങ്ങൾ ക്രമീകരിച്ച സംഖ്യകൾ (1-getting-started-lessons, 2-js-basics, മുതലായവ)
- ഓരോ പ്രോജക്ടിനും `solution/` കൂടാതെ പലപ്പോഴും `start/` അല്ലെങ്കിൽ `your-work/` ഡയറക്ടറികൾ
- പാഠം പ്രത്യേക `images/` ഫോൾഡറുകളിൽ ചിത്രങ്ങൾ സൂക്ഷിക്കുന്നു
- വിവർത്തനങ്ങൾ `translations/{language-code}/` ഘടനയിൽ
## Build and Deployment
### Quiz App Deployment (Azure Static Web Apps)
quiz-app Azure Static Web Apps ലോചനത്തിന് ക്രമീകരിച്ചിരിക്കുന്നു:
```bash
cd quiz-app
npm run build # dist/ ഫോളדער് സൃഷ്ടിക്കുന്നു
# പ്രധാന ബ്രാഞ്ചിലേക്ക് പുഷ് ചെയ്യുമ്പോൾ GitHub Actions വർക്‌ഫ്ലോ ഉപയോഗിച്ച് വിന്യസിക്കുന്നു
```
Azure Static Web Apps ക്രമീകരണം:
- **ആപ്പ് സ്ഥലം**: `/quiz-app`
- **ഔട്ട്പുട്ട് സ്ഥലം**: `dist`
- **വർക്‌ഫ്ലോ**: `.github/workflows/azure-static-web-apps-ashy-river-0debb7803.yml`
### Documentation PDF Generation
```bash
npm install # docsify-to-pdf ഇൻസ്റ്റാൾ ചെയ്യുക
npm run convert # ഡോക്‌സിൽ നിന്ന് PDF സൃഷ്‌ടിക്കുക
```
### Docsify Documentation
```bash
npm install -g docsify-cli # ഡോക്സിഫൈ ആഗോളതലത്തിൽ ഇൻസ്റ്റാൾ ചെയ്യുക
docsify serve # localhost:3000-ൽ സർവ് ചെയ്യുക
```
### Project-specific Builds
ഓരോ പ്രോജക്ട് ഡയറക്ടറിയിലും വ്യത്യസ്ത ബിൽഡ് പ്രക്രിയകൾ ഉണ്ടായി കിടക്കാം:
- Vue പ്രോജക്ടുകൾ: `npm run build` പ്രൊഡക്ഷൻ ബണ്ടлів സൃഷ്ടിക്കുന്നു
- സ്റ്റാറ്റിക് പ്രോജക്ടുകൾ: ബില്‍ഡ് സ്‌റ്റെപ്പ് ഇല്ല, ഫയലുകൾ നേരിട്ട് സർവ് ചെയ്യുക
## Pull Request Guidelines
### Title Format
മാറ്റത്തിന്റെ മേഖലയെ വ്യക്തമായി സൂചിപ്പിക്കുന്ന തലക്കെട്ടുകൾ ഉപയോഗിക്കുക:
- `[Quiz-app] Add new quiz for lesson X`
- `[Lesson-3] Fix typo in terrarium project`
- `[Translation] Add Spanish translation for lesson 5`
- `[Docs] Update setup instructions`
### Required Checks
പി ആർ സമർപ്പിക്കുന്നതിന് മുമ്പ്:
1. **കോഡ് ഗുണമേന്മ**:
- ബാധകമായ പ്രോജക്ട് ഡയറക്ടറികളിൽ `npm run lint` ഓടിക്കുക
- എല്ലാ ലിന്റ് പിശകുകളും മുന്നറിയിപ്പുകളും പരിഹരിക്കുക
2. **ബിൽഡ് പരിശോധന**:
- ബാധകമുള്ള പക്ഷം `npm run build` ഓടിക്കുക
- ബിൽഡ് പിശകുകൾ ഇല്ലെന്ന് ഉറപ്പാക്കുക
3. **ലിങ്ക് പരിശോധന**:
- എല്ലാ മാർക്ക്ഡൗൺ ലിങ്കുകളും പരിശോധിക്കുക
- ഇമേജ് റഫറൻസുകൾ ശരിയാണെന്ന് ഉറപ്പാക്കുക
4. **ഉള്ളടക്കം അവലോകനം**:
- വൃത്തിപരിശോധനയും വ്യാകരണമികവ് പരിശോധിക്കൽ
- കോഡ് ഉദാഹരണങ്ങൾ ശരിയായും വിദ്യാഭ്യാസപരവുമായുണ്ടെന്ന് ഉറപ്പാക്കുക
- വിവർത്തനങ്ങൾ യഥാ അർത്ഥത്തെ നിലനിർ‍ത്തുന്നുണ്ടെന്ന് പരിശോധിക്കുക
### Contribution Requirements
- Microsoft CLA യുമായി അംഗീകരിക്കുക (ആദ്യ PR-ൽ ഓട്ടോമാറ്റിക് പരിശോധന)
- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/) പാലിക്കുക
- വിശദമായ മാർഗനിർദേശങ്ങൾക്ക് [CONTRIBUTING.md](./CONTRIBUTING.md) നോക്കുക
- ആവശ്യമായ പക്ഷം പുൾ റിക്ക്വസ്റ്റ് വിവരണത്തിൽ ഇഷ്യൂ നമ്പറുകൾ ഉൾപ്പെടുത്തുക
### Review Process
- PR കൾ മെയിന്റെയ്‌നർമാർക്കും സമൂഹത്തിനും റിവ്യൂ ചെയ്യപ്പെടും
- വിദ്യാഭ്യാസ വ്യക്തത മുൻഗണനയാണ്
- കോഡ് ഉദാഹരണങ്ങൾ നിലവിലുള്ള മികച്ച രീതികൾ പാലിക്കണം
- വിവർത്തനങ്ങൾ കൃത്യതയോടെ സംസ്ക്കാരപരമായ അനുയോജ്യതയോടെ പരിശോധിക്കും
## Translation System
### Automated Translation
- GitHub Actions ഉപയോഗിച്ച് co-op-translator വർക്ഫ്ലോ ഉപയോഗിക്കുന്നു
- 50+ ഭാഷകളിലേക്ക് ഓട്ടോമാറ്റിക് വിവർത്തനം നൽകുന്നു
- പ്രധാനം ഡയറക്ടറികളിലുള്ള സ്രോത് ഫയലുകൾ
- വിവർത്തന ഫയലുകൾ `translations/{language-code}/` ഡയറക്ടറിയിലാണ്
### Adding Manual Translation Improvements
1. `translations/{language-code}/`യിൽ സ്ഥിതിചെയ്യുന്ന ഫയൽ കണ്ടെത്തുക
2. ഘടന നിലനിർത്തികൊണ്ട് പരിഷ്ക്കാരങ്ങൾ ചെയ്യുക
3. കോഡ് ഉദാഹരണങ്ങൾ പ്രവർത്തനക്ഷമമാണെന്ന് ഉറപ്പാക്കുക
4. ഏതെങ്കിലും പ്രാദേശിക ക്വിസ് ഉള്ളടക്കം പരീക്ഷിക്കുക
### Translation Metadata
വിവർത്തന ഫയലുകളിൽ മെറ്റാഡേറ്റ ഹedersറുകൾ ഉൾപ്പെടുന്നു:
```markdown
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "...",
"translation_date": "...",
"source_file": "...",
"language_code": "..."
}
-->
```
## Debugging and Troubleshooting
### Common Issues
**Quiz app fails to start**:
- Node.js പതിപ്പ് പരിശോധിക്കുക (v14+ ശുപാർശ)
- `node_modules`യും `package-lock.json`യും ഇല്ലാതാക്കി വീണ്ടും `npm install` ഓടിക്കുക
- പോർട്ട് കോൺഫ്ലിക്റ്റുകൾ പരിശോധിക്കുക (ഡീഫോൾട്ട്: Vite വിഷയം 5173)
**API server won't start**:
- Node.js പതിപ്പ് കുറഞ്ഞത് node >=10 ആണെന്ന് ഉറപ്പാക്കുക
- പോർട്ട് ഉപയോഗത്തിലാണ് എന്ന് പരിശോധിക്കുക
- എല്ലാം ഡെപൻഡൻസികളും `npm install` വഴി ഇൻസ്റ്റാൾ ചെയ്തുണ്ടെന്ന് ഉറപ്പാക്കുക
**Browser extension won't load**:
- manifest.json ശരിയായ ഫോർമാറ്റിൽ ആണെന്ന് പരിശോധിക്കുക
- ബ്രൗസർ കോൺസോൾ പിശകുകൾ കാണുക
- ബ്രൗസറിനനുസരിച്ച് എക്സ്‌ടൻഷൻ ഇൻസ്റ്റലേഷൻ മാർഗനിർദേശങ്ങൾ പാലിക്കുക
**Python chat project issues**:
- OpenAI പാക്കേജ് ഇൻസ്റ്റാൾ ചെയ്തിട്ടുണ്ടോ പരിശോധിക്കുക: `pip install openai`
- GITHUB_TOKEN എൻവയോണ്മെന്റ് വേരിയബിൾ സജ്ജമാണെന്ന് ഉറപ്പാക്കുക
- GitHub മോഡൽസ് ആക്സസ് അനുമതികൾ പരിശോധിക്കുക
**Docsify not serving docs**:
- docsify-cli ഗ്ലോബലായി ഇൻസ്റ്റാൾ ചെയ്യുക: `npm install -g docsify-cli`
- റെപ്പോസിറ്ററി റൂട്ടിൽ നിന്നു ഓടിക്കുക
- `docs/_sidebar.md` നിലവിലുണ്ടെന്ന് ഉറപ്പാക്കുക
### Development Environment Tips
- HTML പ്രോജക്ടുകൾക്കുള്ള VS Code Live Server എക്സ്റ്റെൻഷൻ ഉപയോഗിക്കുക
- ഏകാസംബന്ധിതമായ ഫോർമാറ്റ്‌ക്കായി ESLint, Prettier എക്സ്റ്റൻഷനുകൾ ഇൻസ്റ്റാൾ ചെയ്യുക
- JavaScript ഡീബഗ് ചെയ്യാൻ ബ്രൗസർ ഡെവ്ടൂൾസ് ഉപയോഗിക്കുക
- Vue പ്രോജക്ടുകൾക്കായി Vue DevTools ബ്രൗസർ എക്സ്‌ടൻഷൻ ഇൻസ്റ്റാൾ ചെയ്യുക
### Performance Considerations
- 50+ ഭാഷകളിലുള്ള വിവർത്തിത ഫയലുകളുടെ എണ്ണം വലിയതാണ്, ഫുൾ ക്ലോണുകൾ വലിയതാണ്
- ഉള്ളടക്കത്തിൽ മാത്രം പ്രവർത്തിക്കുന്നവർക്ക് ഷാലോ ക്ലോൺ ഉപയോഗിക്കുക: `git clone --depth 1`
- ഇംഗ്ലീഷ് ഉള്ളടക്കത്തിൽ നടത്തിയപ്പോൾ വിവർത്തനങ്ങൾ തിരയൽ പുറത്താകുന്നതായി ഒഴിവാക്കുക
- ആദ്യ ഓടിയിൽ ബിൽഡ് പ്രക്രിയകൾ (npm install, Vite build) നിത്യം സാധാരണയായി ക്ഷീണാകും
## Security Considerations
### Environment Variables
- API കീകൾ രെപ്പോസിറ്ററിയിൽ ഒരിക്കലും കമ്മിറ്റ് ചെയ്യരുത്
- `.env` ഫയലുകൾ ഉപയോഗിക്കുക (ഇതെല്ലാം `.gitignore`-ലുണ്ട്)
- ആവശ്യമായ എൻ‌വയോൺമെന്റ് വേരിയബിളുകൾ പ്രോജക്ട് READMEs-ൽ രേഖപ്പെടുത്തുക
### Python Projects
- വെർച്ച്വൽ എൻ‌വയോൺമെന്റ് ഉപയോഗിക്കുക: `python -m venv venv`
- ഡെപൻഡൻസികൾ അപ്ഡേറ്റ് ചെയ്ത് വയ്ക്കുക
- GitHub ടോക്കണുകൾക്ക് കുറഞ്ഞ ആവശ്യമായ അനുമതികൾ മാത്രം നൽകുക
### GitHub Models Access
- GitHub മോഡലുകളിലേക്കുള്ള വ്യക്തിഗത ആക്‌സസ് ടോക്കണുകൾ ആവശ്യമാണ് (PAT)
- ടോക്കണുകൾ എൻ‌വയോൺമെന്റ് വേരിയബിളുകളായി സൂക്ഷിക്കുക
- ടോക്കണുകൾ അല്ലെങ്കിൽ ക്രെഡൻഷ്യലുകൾ ഒരിക്കലും കമ്മിറ്റ് ചെയ്യരുത്
## Additional Notes
### Target Audience
- വെബ് വികസനത്തിൽ പൊതുവായി തുടങ്ങുന്നവർ
- വിദ്യാർത്ഥികളും സവാൽ പഠനക്കാരും
- ക്ലാസറूमിൽ പാഠ്യപദ്ധതി ഉപയോഗിക്കുന്ന അധ്യാപകർ
- പ്രവേശന യോഗ്യതയും നേതൃത്വപരവും ഉള്ള ഉള്ളടക്കം
### Educational Philosophy
- പദ്ധതിപരമായ പഠന സമീപനം
- സ്ഥിരം അറിവ് പരിശോധിക്കൽ (ക്വിസുകൾ)
- പ്രായോഗിക കോഡിംഗ് അഭ്യാസങ്ങൾ
- യാഥാർത്ഥ്യ ലോക ഉദാത്തങ്ങൾ
- ഫ്രെയിംവർക്കുകളുടെ മുമ്പ് അടിസ്ഥാന സിദ്ധാന്തങ്ങൾ
### Repository Maintenance
- സജീവമായ പഠനക്കാരുടെയും പങ്കാളികളുടെയും സമൂഹം
- ഡെപെൻഡൻസികളും ഉള്ളടക്കവും নিয়മിതമായി നവീകരിക്കുന്നു
- മെയിന്റെയ്‌നർമാരും ചര്‍ച്ചകളും ശ്രദ്ധിക്കുന്നു
- GitHub Actions മുഖേന വിവർത്തന അപ്ഡേറ്റുകൾ സ്വയംനടത്തുന്നു
### Related Resources
- [Microsoft Learn modules](https://docs.microsoft.com/learn/)
- [Student Hub resources](https://docs.microsoft.com/learn/student-hub/)
- [GitHub Copilot](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot) പഠനാർത്ഥികൾക്ക് ശുപാർശ ചെയ്യുന്നു
- അധിക കോഴ്സുകൾ: Generative AI, Data Science, ML, IoT പാഠ്യങ്ങള്
### Working with Specific Projects
തനതു പ്രോജക്ടുകൾക്കുള്ള വിശദമായ നിർദ്ദേശങ്ങൾക്കായി വായിക്കുക:
- `quiz-app/README.md` - Vue 3 ക്യൂvis് ആപ്പ്
- `7-bank-project/README.md` - ബാൻക് ആപ്പ് ഓത്തന്റിക്കേഷൻ സെറ്റ് ചെയ്യപ്പെട്ടത്
- `5-browser-extension/README.md` - ബ്രൗസർ എക്സ്റ്റെൻഷൻ വികസനം
- `6-space-game/README.md` - കാൻവാസ് അടിസ്ഥാനമായ ഗെയിം വികസനം
- `9-chat-project/README.md` - AI ചാറ്റ് അസിസ്റ്റന്റ് പ്രോജക്ട്
### Monorepo Structure
പരമ്പരാഗത മോനോറിപ്പോ അല്ലെങ്കിലും, ഈ റെപ്പോസിറ്ററി പല സ്വതന്ത്ര പ്രോജക്ടുകൾ ഉൾക്കൊള്ളുന്നു:
- ഓരോ പാഠവും സ്വതന്ത്രമാണ്
- പ്രോജക്ടുകൾ പരസ്പരം ഡെപൻഡൻസികൾ പങ്കിടുന്നില്ല
- മറ്റുള്ളവരെ ബാധിക്കാതെ വ്യക്തിഗത പ്രോജക്ടുകളിൽ പ്രവർത്തിക്കുക
- മുഴുവൻ പാഠ്യപദ്ധതി അനുഭവത്തിനായി മുഴുവൻ റെപ്പോ ക്ലോൺ ചെയ്യുക
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**അസൂയാനിർദ്ദേശം**:
ഈ രേഖ AI വിവർത്തനം സേവനം [Co-op Translator](https://github.com/Azure/co-op-translator) ഉപയോഗിച്ച് വിവർത്തനം ചെയ്‌തതാണ്. ഞങ്ങൾ പരമാവധി ശരിക്കും ശ്രമിക്കുന്നുവെങ്കിലും, സ്വയംക്രമിത വിവർത്തനങ്ങളിൽ പിഴവുകളോ അസാധ്യതകളോ ഉണ്ടാകാൻ സാധ്യതയുള്ളതാണ്. അതിനാൽ, ദയവായി ശ്രദ്ധിക്കേണ്ടത്, ഈ രേഖയുടെ മുമ്ബ് ഉള്ള ഭാഷയിലുള്ള യുഗ്മം പ്രാമാണിക സ്രോതസ്സായി കണക്കാക്കണം. നിർണായക വിവരങ്ങൾക്ക് പ്രൊഫഷണൽ മനുഷ്യ വിവർത്തനം ശിപാർശ ചെയ്യുന്നു. ഈ വിവർത്തനത്തിന്റെ ഉപയോഗത്തെത്തുടർന്ന് ഉണ്ടാകുന്ന ഏതെങ്കിലും തെറ്റിദ്ധാരണകൾക്കും അർത്ഥവിമർശങ്ങൾക്കും ഞങ്ങൾ ഉത്തരവാദികളല്ല.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,25 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "b0a9b4cccd918195f58224d5793da1a6",
"translation_date": "2026-01-08T10:34:33+00:00",
"source_file": "CODE_OF_CONDUCT.md",
"language_code": "ml"
}
-->
# മൈക്രോസ്‌ഫ്റ്റ് ഓപ്പൺ സോഴ്സ് പെരുമാറ്റ നയം
ഈ പ്രോജക്ട് [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/?WT.mc_id=academic-77807-sagibbon) സ്വീകരിച്ചിരിക്കുന്നു.
രിസോഴ്സുകൾ:
- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/?WT.mc_id=academic-77807-sagibbon)
- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/?WT.mc_id=academic-77807-sagibbon)
- ചോദിക്കാനും ആശങ്കകളുള്ളപ്പോൾ [opencode@microsoft.com](mailto:opencode@microsoft.com) എന്ന വിലാസത്തിൽ ബന്ധപ്പെടുക
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**കുറിപ്പ്**:
ഈ പ്രമാണം AI വിവർത്തന സേവനമായ [Co-op Translator](https://github.com/Azure/co-op-translator) ഉപയോഗിച്ച് വിവർത്തനം ചെയ്തതാണ്. ഞങ്ങൾ നിശ്ചിതത്വത്തിനായി ശ്രമിച്ചെങ്കിലും, സോഫ്റ്റ്വെയർ വിവർത്തനങ്ങളിൽ തെറ്റുകളോ അകിതാത്മകതകളോ ഉണ്ടാകാമെന്ന് ശ്രദ്ധിക്കുക. ഔദ്യോഗിക ഭാഷയിലെ മൂല പ്രമാണം പ്രാമാണികമായ ഉറവിടമായി കണക്കാക്കേണ്ടതാണ്. നിർണായകമായ വിവരങ്ങൾക്ക്, വിദഗ്ധ മനുഷ്യ വിവർത്തനം നിർബന്ധം ആണ്. ഈ വിവർത്തനത്തിൽ നിന്നുണ്ടാകുന്ന തെറ്റു ബോധ്യങ്ങൾക്കോ തെറ്റായ വ്യാഖ്യാനങ്ങൾക്കോ ഞങ്ങൾ ഉത്തരവാദികളല്ല.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,30 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "777400e9f0336c7ee2f9a1200a88478f",
"translation_date": "2026-01-08T10:14:33+00:00",
"source_file": "CONTRIBUTING.md",
"language_code": "ml"
}
-->
# സംഭാവനകൾ
ഈ പ്രോജക്ട് സംഭാവനകളും നിർദ്ദേശങ്ങളും സ്വാഗതം ചെയ്യും. ഏറ്റവും അധികം സംഭാവനകൾ നിങ്ങൾക്ക്
കൺട്രിബ്യുട്ടർ ലൈസൻസ് അക്രമം (CLA) യിൽ സമ്മതമാകും എന്നത് ആവശ്യമാണ്, നിങ്ങൾക്ക് അവകാശമുണ്ടെന്ന്
ഉണ്ടെന്നും, വാസ്തവത്തിൽ ബഹുമതികൾ നൽകുന്നുവെന്ന് അറിയിക്കുന്ന CLA യിൽ. കൂടുതലായി വിവരങ്ങൾക്കായി സന്ദർശിക്കുക
[https://cla.microsoft.com](https://cla.microsoft.com/?WT.mc_id=academic-77807-sagibbon).
നിങ്ങൾ ഒരു പുൾ റിക്വസ്റ്റ് സമർപ്പിക്കുമ്പോൾ, CLA-ബോട്ട് ഓട്ടോമാറ്റിക്കായി നിങ്ങൾക്കു CLA നൽകേണ്ടതുണ്ടോ എന്ന്
നിശ്ചയിക്കുകയും, PR യെ അനുയോജ്യമായി അലങ്കരിക്കുകയും ചെയ്യും (ഉദാ: ലേബൽ, കാമന്റ്). ബോട്ടിന്റെ
निर्देशങ്ങൾ പിന്തുടരുക. നമ്മുടെ CLA ഉപയോഗിക്കുന്ന എല്ലാ റിപ്പോസിറ്ററികളിലും നിങ്ങൾക്ക് ഇത് ഒരു തവണ മാത്രം ചെയ്യേണ്ടതാകും. ദയവായി, എന്തിനാണ് നിങ്ങൾ ആ മാറ്റം ചെയ്‌തതെന്ന് ഞങ്ങൾക്ക് അറിയിക്കാനും চেষ্টা ചെയ്യുക, അതിലൂടെ നിങ്ങളുടെ അഭ്യർത്ഥനയെ കുറിച്ച് നാം മെച്ചത്തിൽ മനസിലാക്കാം.
ഈ പ്രോജക്ട് [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/?WT.mc_id=academic-77807-sagibbon) നെ ആപേക്ഷിച്ചു.
കൂടുതൽ വിവരങ്ങൾക്ക്, [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/?WT.mc_id=academic-77807-sagibbon) നോക്കുക
അല്ലെങ്കിൽ [opencode@microsoft.com](mailto:opencode@microsoft.com) എന്ന വിലാസത്തിൽ അധിക сұрақങ്ങൾക്കോ അഭിപ്രായങ്ങളിലോ ബന്ധപ്പെടുക.
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**സ്ഥിരീകരണം**:
ഈ രേഖ AI വിവർത്തന സേവനം [Co-op Translator](https://github.com/Azure/co-op-translator) ഉപയോഗിച്ച് വിവർത്തനം ചെയ്‌തിരിക്കുന്നു. നമുക്ക് കൃത്യതക്ക് ശ്രമിച്ചെങ്കിലും, ഓട്ടോമേറ്റഡ് വിവർത്തനങ്ങളിൽ പിശകുകൾ അല്ലെങ്കിൽ ദോഷങ്ങൾ ഉണ്ടാകാമെന്ന് ദയവായി മനസിലാക്കുക. അതിന്റെ സ്വതന്ത്ര ഭാഷയിലുള്ള യഥാർത്ഥ രേഖ അധികൃതമായ ഉറവിടമായി കണക്കാക്കേണ്ടതാണ്. അതിജീവക വിവരങ്ങൾക്ക്, പ്രൊഫഷണൽ മനുഷ്യ വിവർത്തനം ശിപാർശ ചെയ്യപ്പെടുന്നു. ഈ വിവർത്തനത്തിന്റെ ഉപയോഗത്തിൽ നിന്നാകുന്ന തെറ്റിദ്ധാരണകൾക്കും വ്യാഖ്യാനക്കേടുകൾക്കും ഞങ്ങൾ ഉത്തരവാദികളല്ല.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,137 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "5cf5e1ed51455fefed4895fcc4d6ba2a",
"translation_date": "2026-01-08T10:47:28+00:00",
"source_file": "Git-Basics/README.md",
"language_code": "ml"
}
-->
## വെബ്-ഡെവ് തുടങ്ങിയവർക്ക് ഉപകാരപ്രദമായ GIT അടിസ്ഥാനങ്ങൾ👶
## `Git` എന്താണ്?
1. Git ഒരു വിതരണവത്കരിച്ച പതിപ്പു നിയന്ത്രണ സിസ്റ്റമാണ്.
2. പൂർണ്ണ കോഡ്‌ബേസ്, ചരിത്രം ഓരോ ഡെവലപ്പറുടെയും കമ്പ്യൂട്ടറിൽ തന്നെ ലഭ്യമാണ്,
ഇത് ബ്രാഞ്ചിംഗ്, മേഴ്‍ജിംഗ് എളുപ്പമാക്കുന്നു.
3. കമ്പ്യൂട്ടർ ഫയലുകളിലെ മാറ്റങ്ങൾ ട്രാക്ക് ചെയ്യാൻ പതിപ്പു നിയന്ത്രണ സിസ്റ്റമായി (VCS) ഉപയോഗിക്കുന്നു.
* വിതരണവത്കരിച്ച പതിപ്പു നിയന്ത്രണം
* ബഹുഡെവലപ്പർമാരുടെ ഇടയിൽ ജോലി ഏകോപിപ്പിക്കുന്നു
* ആരാണ് എന്ത് മാറ്റം ചെയ്തതും എപ്പോഴാണ് ചെയ്തത് എന്നിവ അറിയാം
* വേണമെങ്കിൽ തിരിച്ചു revert ചെയ്യാം
* ലോക്കൽ & റിമോട്ട് റീപ്പോസ്
## GIT യുടെ ആശയങ്ങൾ
* കോഡ് ചരിത്രം ട്രാക്ക് ചെയ്യുന്നു
* നിങ്ങളുടെ ഫയലുകളുടെ "സ്നാപ്ഷോട്ടുകൾ" എടുക്കുന്നു
* "കമ്മിറ്റ്" ചെയ്ത് നിങ്ങൾക്ക് സ്നാപ്ഷോട്ട് എടുക്കാന്‍ സമയമെടുത്താൽ
* ഏതൊരൊക്കെ സ്നാപ്ഷോട്ട് വേണമെങ്കിലും സന്ദർശിക്കാം
* കമ്മിറ്റ് ചെയ്യാനുള്ള മുമ്പ് ഫയലുകൾ സ്റ്റേജിംഗ് ചെയ്യാം
### Git & GitHub ന്റെ വ്യത്യാസം
| Git | GitHub |
| ------- | ----------- |
| Git ഒരു സോഫ്റ്റ്‌വെയർ ആണ് | GitHub ക്ലൗഡ് സേവനമാണ് |
| Git സിസ്റ്റത്തിൽ ലോക്കലി ഇൻസ്റ്റാൾ ചെയ്തിരിക്കുന്നത് | GitHub വെബിൽ ഹോസ്റ്റ് ചെയ്തിരിക്കുന്നു |
| കമാൻഡ്-ലൈൻ ടൂൾ ആണ് | ഗ്രാഫിക്കൽ യൂസർ ഇന്റർഫേസ് ആണ് |
| Git ലിനക്സിൽ പരിപാലിക്കപ്പെടുന്നു | GitHub മൈക്രോസോഫ്റ്റ് പരിപാലിക്കുന്നു |
| പതിപ്പു നിയന്ത്രണത്തിലും കോഡ് ഷെയറിംഗിലും കേന്ദ്രീകരിച്ചിരിക്കുന്നു | കേന്ദ്രീകൃത സോഴ്‌സ് കോഡ് ഹോസ്റ്റിങ്ങിൽ കേന്ദ്രീകരിച്ചിരിക്കുന്നു |
| Git ഓപ്പൺ-സോഴ്സ് ലൈസൻസുള്ളതാണ് | GitHub സൗജന്യവും പണം നൽകേണ്ട തരം ഉള്ലതാണ് |
| Git 2005-ൽ റിലീസ് ചെയ്തു | GitHub 2008-ൽ ഇറക്കി |
## GIT ഇൻസ്റ്റലേഷൻ
* Linux(Debian)
`$sudo apt-get install git`
* Linux(Fedora)
`$sudo yum install git`
* [ഡൗൺലോഡ്](http://git-scm.com/download/mac) മാക്കിനുള്ളത്
* [ഡൗൺലോഡ്](http://git-scm.com/download/win) വിന്‍ഡോസിനുള്ളത്
### ഇൻസ്റ്റലേഷൻ പ്രക്രിയയുടെ ഘട്ടങ്ങൾ:
1. <img width="500" height="400" src="https://user-images.githubusercontent.com/61585443/190359823-e421b976-515a-4565-990d-2f2e4e62977a.png"/>
2. <img width="500" height="400" src="https://user-images.githubusercontent.com/61585443/190360530-a7bfa681-47f4-4859-9b8a-4120e0cad348.png"/>
3. <img width="500" height="400" src="https://user-images.githubusercontent.com/61585443/190360760-30db7768-19e0-4848-a99d-a6c955e041e2.png"/>
4. <img width="500" height="400" src="https://user-images.githubusercontent.com/61585443/190360896-473e1e54-f083-4b5c-a5f0-539f70469142.png"/>
5. <img width="500" height="400" src="https://user-images.githubusercontent.com/61585443/190361144-bc670a2b-b776-4867-9785-7b509d416fbb.png"/>
6. പിന്നീട് Next > Next > Next > <b>Install</b> ക്ലിക്ക് ചെയ്യുക
7. <img width="500" height="400" src="https://user-images.githubusercontent.com/61585443/190361548-4b700d85-c7d5-4d26-90e7-e5cc3ce24311.png"/>
### ഇൻസ്റ്റലേഷൻ കഴിഞ്ഞ് git bash ഉപയോഗിച്ച് git കോൺഫിഗർ ചെയ്യേണ്ടത്
1. `git config --global user.name 'YourName'`
2. `git config --global user.email 'YourEmail'`
___
## Git കമാൻഡുകൾ
___
### പ്രോജക്ടുകൾ സ്വീകരിക്കുക & സൃഷ്ടിക്കുക
| കമാൻഡ് | വിവരണം |
| ------- | ----------- |
| `git init` | ഒരു ലോക്കൽ Git റീപ്പോസിറ്ററി ആദ്യം സൃഷ്ടിക്കുക |
| `git clone ssh://git@github.com/[username]/[repository-name].git` | ഒരു റിമോട്ട് റീപ്പോസിറ്ററി ലോക്കലിലേക്ക് കോപ്പി ചെയ്യുക |
### അടിസ്ഥാന സ്നാപ്ഷോട്ടിംഗ്
| കമാൻഡ് | വിവരണം |
| ------- | ----------- |
| `git status` | നിലവാര പരിശോധിക്കുക |
| `git add [file-name.txt]` | ഒരു ഫയൽ സ്റ്റേജിംഗ് ഏരിയയിൽ ചേർക്കുക |
| `git add -A` | എല്ലാ പുതിയ മാറ്റം വന്ന ഫയലുകളും സ്റ്റേജിംഗിലേക്ക് ചേർക്കുക |
| `git commit -m "[commit message]"` | മാറ്റങ്ങൾ കമ്മിറ്റ് ചെയ്യുക |
| `git rm -r [file-name.txt]` | ഫയലോ ഫോൾഡരോ ഒഴിവാക്കുക |
| `git push` | റിമോട്ട് റീപ്പോവിലേക്ക് എടുക്കുക |
| `git pull` | റിമോട്ട് റീപ്പോവിൽ നിന്നുള്ള ഏറ്റവും പുതിയ മാറ്റങ്ങൾ സ്വീകരിക്കുക |
### ബ്രാഞ്ചിംഗ് & മേഴ്‌ജിംഗ്
| കമാൻഡ് | വിവരണം |
| ------- | ----------- |
| `git branch` | ബ്രാഞ്ചുകൾ പട്ടികപ്പെടുത്തുക (ഇപ്പോൾ ഉള്ള ബ്രാഞ്ചിന് അടിയന്തരചിഹ്നം) |
| `git branch -a` | എല്ലാ ബ്രാഞ്ചുകളും പട്ടികപ്പെടുത്തുക (ലോകൽ & റിമോട്ട്) |
| `git branch [branch name]` | പുതിയ ഒരു ബ്രാഞ്ച് സൃഷ്ടിക്കുക |
| `git branch -D [branch name]` | ഒരു ബ്രാഞ്ച് ഇല്ലാക്കുക |
| `git push origin --delete [branch name]` | റിമോട്ട് ബ്രാഞ്ച് നീക്കം ചെയ്യുക |
| `git checkout -b [branch name]` | ഒരു പുതിയ ബ്രാഞ്ച് സൃഷ്ടിച്ച് അതിലേക്ക് മാറുക |
| `git checkout -b [branch name] origin/[branch name]` | റിമോട്ട് ബ്രാഞ്ച് ക്ലോൺ ചെയ്ത് അതിലേക്ക് മാറുക |
| `git branch -m [old branch name] [new branch name]` | ഒരു ബ്രാഞ്ചിന് പുതിയ പേര് നൽകുക |
| `git checkout [branch name]` | ഒരു ബ്രാഞ്ചിലേക്ക് മാറുക |
| `git checkout -` | അവസാനമായി മാറിയ ബ്രാഞ്ചിലേക്ക് മാറുക |
| `git checkout -- [file-name.txt]` | ഫയലിലെ മാറ്റങ്ങൾ ഒഴിവാക്കുക |
| `git merge [branch name]` | ഒരു ബ്രാഞ്ച് ചാലക ബ്രാഞ്ചിലേക്ക് മേഴ്‌ജ് ചെയ്യുക |
| `git merge [source branch] [target branch]` | ഒരു ബ്രാഞ്ച് ലക്ഷ്യമിട്ട ബ്രാഞ്ചിലേക്ക് മർജ്ജ് ചെയ്യുക |
| `git stash` | പ്രവർത്തനസമയത്തെ മാറ്റങ്ങൾ സ്റ്റാഷ് ചെയ്യുക |
| `git stash clear` | എല്ലാ സ്റ്റാഷിലെ എൻട്രികളും നീക്കം ചെയ്യുക |
### പ്രോജക്ടുകൾ പങ്കുവെക്കൽ & അപ്‌ഡേറ്റ് ചെയ്യൽ
| കമാൻഡ് | വിവരണം |
| ------- | ----------- |
| `git push origin [branch name]` | ഒരു ബ്രാഞ്ച് റിമോട്ട് റീപ്പോയിലേക്ക് പുഷ് ചെയ്യുക |
| `git push -u origin [branch name]` | റിമോട്ട് റീപ്പോയിലേക്ക് മാറ്റങ്ങൾ പുഷ് ചെയ്യുക (ബ്രാഞ്ച് ഓർമപ്പെടുത്തുക) |
| `git push` | റിമോട്ട് റീപ്പോയിലേക്ക് മാറ്റങ്ങൾ പുഷ് ചെയ്യുക (ഓർമിച്ച ബ്രാഞ്ച്) |
| `git push origin --delete [branch name]` | റിമോട്ട് ബ്രാഞ്ച് ഇല്ലാക്കുക |
| `git pull` | ലോക്കൽ റീപ്പോ പുതിയ കമ്മിറ്റിലേക്ക് അപ്‌ഡേറ്റ് ചെയ്യുക |
| `git pull origin [branch name]` | റിമോട്ട് റീപ്പോയിൽ നിന്നുള്ള മാറ്റങ്ങൾ വലിക്കുക |
| `git remote add origin ssh://git@github.com/[username]/[repository-name].git` | ഒരു റിമോട്ട് റീപ്പോ ചേർക്കുക |
| `git remote set-url origin ssh://git@github.com/[username]/[repository-name].git` | റീപ്പോയുടെ ഓറിജിൻ ബ്രാഞ്ച് SSH ആയി ക്രമീകരിക്കുക |
### പരിശോധന & താരതമ്യം
| കമാൻഡ് | വിവരണം |
| ------- | ----------- |
| `git log` | മാറ്റങ്ങൾ കാണുക |
| `git log --summary` | മാറ്റങ്ങൾ (വിശദമായി) കാണുക |
| `git log --oneline` | മാറ്റങ്ങൾ (സംഗ്രഹത്തിൽ) കാണുക |
| `git diff [source branch] [target branch]` | മർജ്ജിന് മുൻപ് മാറ്റങ്ങൾ മുൻകൂർ കാണുക |
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**അസൂയാരഹിത കുറിപ്പ്**:
ഈ രേഖ [Co-op Translator](https://github.com/Azure/co-op-translator) എന്ന AI പരിഭാഷാ സേവനം ഉപയോഗിച്ച് വിവർത്തനം ചെയ്തതാണ്. നാം ശരിയായ വിവർത്തനത്തിനായി ശ്രമിച്ചേക്കിലും, സ്വയംചാലിതമായ വിവർത്തനങ്ങളിൽ പിഴവുകൾ അല്ലെങ്കിൽ തട്ടിപ്പുകൾ ഉണ്ടാകാമെന്ന് ദയവായി ശ്രദ്ധിക്കുക. മൊഴിയിൽ നിന്നുള്ള യഥാർത്ഥ രേഖ കാര്യനിർണായക മേധാവി ഉറവിടമായി കണക്കാക്കപ്പെടുകയാണെന്ന് ദയവായി കാണുക. അത്യന്താപേക്ഷിത വിവരങ്ങൾക്കായി ഒരു പ്രൊഫഷണൽ മാനവ പരിഭാഷ ശിപാർശ ചെയ്യപ്പെടുന്നു. ഈ വിവർത്തനത്തിന്റെ ഉപയോഗത്തിൽ നിന്നുണ്ടാകുന്ന ഏതെങ്കിലും തെറ്റിദ്ധാരണകൾക്കും ഓർമ്മക്കുറിവുകൾക്കും біз ഉത്തരവാദികളല്ല.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,280 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "fea3a0fceb8ad86fd640c09cf63a2aac",
"translation_date": "2026-01-08T10:40:10+00:00",
"source_file": "README.md",
"language_code": "ml"
}
-->
[![GitHub license](https://img.shields.io/github/license/microsoft/Web-Dev-For-Beginners.svg)](https://github.com/microsoft/Web-Dev-For-Beginners/blob/master/LICENSE)
[![GitHub contributors](https://img.shields.io/github/contributors/microsoft/Web-Dev-For-Beginners.svg)](https://GitHub.com/microsoft/Web-Dev-For-Beginners/graphs/contributors/)
[![GitHub issues](https://img.shields.io/github/issues/microsoft/Web-Dev-For-Beginners.svg)](https://GitHub.com/microsoft/Web-Dev-For-Beginners/issues/)
[![GitHub pull-requests](https://img.shields.io/github/issues-pr/microsoft/Web-Dev-For-Beginners.svg)](https://GitHub.com/microsoft/Web-Dev-For-Beginners/pulls/)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
[![GitHub watchers](https://img.shields.io/github/watchers/microsoft/Web-Dev-For-Beginners.svg?style=social&label=Watch&maxAge=2592000)](https://GitHub.com/microsoft/Web-Dev-For-Beginners/watchers/)
[![GitHub forks](https://img.shields.io/github/forks/microsoft/Web-Dev-For-Beginners.svg?style=social&label=Fork&maxAge=2592000)](https://GitHub.com/microsoft/Web-Dev-For-Beginners/network/)
[![GitHub stars](https://img.shields.io/github/stars/microsoft/Web-Dev-For-Beginners.svg?style=social&label=Star&maxAge=2592000)](https://GitHub.com/microsoft/Web-Dev-For-Beginners/stargazers/)
[![Microsoft Foundry Discord](https://dcbadge.limes.pink/api/server/nTYy5BXMWG)](https://discord.gg/nTYy5BXMWG)
# തുടക്കക്കാർക്ക് വെബ് ഡെവലപ്പ്മെന്റ് - ഒരു കോർസ്സ്
Microsoft Cloud Advocates ഒരുക്കുന്ന 12 ആഴ്ചകളിലായി മുഴുവനായുള്ള കോഴ്‌സിലൂടെ വെബ് വികസനത്തിന്റെ അടിസ്ഥാനങ്ങൾ പഠിക്കുക. 24 പാഠങ്ങളിലൊരൊന്ന് JavaScript, CSS, HTML എന്നിവ കൈകൊണ്ട് ചെയ്യാവുന്ന പ്രോജക്ടുകളായ ടെറരിയം, ബ്രൗസർ എക്സ്റ്റൻഷനുകൾ, സ്‌പേസ് ഗെയിമുകൾ തുടങ്ങിയവയിലൂടെയാണ് പഠിപ്പിക്കുന്നത്. ക്വിസുകൾ, ചർച്ചകൾ, പ്രായോഗിക അസൈൻമെന്റുകൾ എന്നിവയിലും പങ്കെടുക്കുക. വിന്യസാധ്യമായ പ്രോജക്റ്റ്-അടിസ്ഥാന പഠനരീതിയിലൂടെ നിങ്ങളുടെ കഴിവുകൾ മെച്ചപ്പെടുത്തുകയും അറിവ് മെച്ചപ്പെടുത്തുകയും ചെയ്യുക. ഇന്ന് തന്നെ നിങ്ങളുടെ കോഡിംഗ് യാത്ര ആരംഭിക്കൂ!
Azure AI Foundry Discord Community യിൽ ചേരൂ
[![Microsoft Foundry Discord](https://dcbadge.limes.pink/api/server/nTYy5BXMWG)](https://discord.gg/nTYy5BXMWG)
ഈ വിഭവങ്ങൾ ഉപയോഗിച്ച് ആരംഭിക്കാൻ താഴെപ്പറയുന്ന ഘട്ടങ്ങൾ പാലിക്കുക:
1. **റിപ്പോസിറ്ററി ഫോർക്കുചെയ്യുക**: ക്ലിക്ക് ചെയ്യുക [![GitHub forks](https://img.shields.io/github/forks/microsoft/Web-Dev-For-beginners.svg?style=social&label=Fork)](https://GitHub.com/microsoft/Web-Dev-For-Beginners/fork)
2. **റിപ്പോസിറ്ററി ക്ലോൺ ചെയ്യുക**: `git clone https://github.com/microsoft/Web-Dev-For-Beginners.git`
3. [**Azure AI Foundry Discord ലായി ചേരുക, വിദഗ്ധരും മറ്റ് ഡെവലപ്പർമാരും കാണുക**](https://discord.com/invite/ByRwuEEgH4)
### 🌐 പലഭാഷാ പിന്തുണ
#### GitHub Action വഴി (സ്വയംപ്രവർത്തനം & എല്ലായ്പ്പോഴും പുതുക്കിയാവുന്ന)
<!-- CO-OP TRANSLATOR LANGUAGES TABLE START -->
[Arabic](../ar/README.md) | [Bengali](../bn/README.md) | [Bulgarian](../bg/README.md) | [Burmese (Myanmar)](../my/README.md) | [Chinese (Simplified)](../zh/README.md) | [Chinese (Traditional, Hong Kong)](../hk/README.md) | [Chinese (Traditional, Macau)](../mo/README.md) | [Chinese (Traditional, Taiwan)](../tw/README.md) | [Croatian](../hr/README.md) | [Czech](../cs/README.md) | [Danish](../da/README.md) | [Dutch](../nl/README.md) | [Estonian](../et/README.md) | [Finnish](../fi/README.md) | [French](../fr/README.md) | [German](../de/README.md) | [Greek](../el/README.md) | [Hebrew](../he/README.md) | [Hindi](../hi/README.md) | [Hungarian](../hu/README.md) | [Indonesian](../id/README.md) | [Italian](../it/README.md) | [Japanese](../ja/README.md) | [Kannada](../kn/README.md) | [Korean](../ko/README.md) | [Lithuanian](../lt/README.md) | [Malay](../ms/README.md) | [Malayalam](./README.md) | [Marathi](../mr/README.md) | [Nepali](../ne/README.md) | [Nigerian Pidgin](../pcm/README.md) | [Norwegian](../no/README.md) | [Persian (Farsi)](../fa/README.md) | [Polish](../pl/README.md) | [Portuguese (Brazil)](../br/README.md) | [Portuguese (Portugal)](../pt/README.md) | [Punjabi (Gurmukhi)](../pa/README.md) | [Romanian](../ro/README.md) | [Russian](../ru/README.md) | [Serbian (Cyrillic)](../sr/README.md) | [Slovak](../sk/README.md) | [Slovenian](../sl/README.md) | [Spanish](../es/README.md) | [Swahili](../sw/README.md) | [Swedish](../sv/README.md) | [Tagalog (Filipino)](../tl/README.md) | [Tamil](../ta/README.md) | [Telugu](../te/README.md) | [Thai](../th/README.md) | [Turkish](../tr/README.md) | [Ukrainian](../uk/README.md) | [Urdu](../ur/README.md) | [Vietnamese](../vi/README.md)
> **സ്ഥാനികമായി ക്ലോൺ ചെയ്യാൻ ഇഷ്ടപ്പെടുന്നവർ?**
> ഈ റിപോസിറ്ററിയിൽ 50-ലേറെ ഭാഷാ വിവർത്തനങ്ങൾ ഉൾക്കൊള്ളുന്നുവെന്ന് പ്രത്യേകം ഡൗൺലോഡ് വലുപ്പം വർദ്ധിപ്പിക്കുന്നു. വിവർത്തനങ്ങൾ ഇല്ലാതെ ക്ലോൺ ചെയ്യാൻ, sparse checkout ഉപയോഗിക്കുക:
> ```bash
> git clone --filter=blob:none --sparse https://github.com/microsoft/Web-Dev-For-Beginners.git
> cd Web-Dev-For-Beginners
> git sparse-checkout set --no-cone '/*' '!translations' '!translated_images'
> ```
> ഇതുവഴി നിങ്ങൾക്ക് കോഴ്‌സ് പൂർത്തിയാക്കാൻ വേണ്ടിയുള്ള എല്ലാ കാര്യങ്ങളും വളരെ വേഗത്തിൽ ഡൗൺലോഡ് ചെയ്യാവുന്നതാണ്.
<!-- CO-OP TRANSLATOR LANGUAGES TABLE END -->
**കൂടുതൽ വിവർത്തന ഭാഷകൾ ഈ ലിങ്കിൽ ചുരുക്കി നൽകിയിട്ടുണ്ട് [ഇവിടെ](https://github.com/Azure/co-op-translator/blob/main/getting_started/supported-languages.md)**
[![Open in Visual Studio Code](https://img.shields.io/static/v1?logo=visualstudiocode&label=&message=Open%20in%20Visual%20Studio%20Code&labelColor=2c2c32&color=007acc&logoColor=007acc)](https://open.vscode.dev/microsoft/Web-Dev-For-Beginners)
#### 🧑‍🎓 _നിങ്ങൾ ഒരു വിദ്യാർത്ഥിയാണോ?_
[**സ്റ്റുഡന്റ് ഹബ് പേജ്**](https://docs.microsoft.com/learn/student-hub/?WT.mc_id=academic-77807-sagibbon) സന്ദർശിക്കുക, അവിടെ നിങ്ങൾക്ക് തുടക്കക്കാരുടെ വിഭവങ്ങൾ, സ്റ്റുഡന്റ് പാക്കുകൾ, ഒരു സൗജന്യ സർട്ടിഫിക്കറ്റ് വൗച്ചർ നേടാനുള്ള മാർഗ്ഗങ്ങൾ എന്നിവ ലഭ്യമാണ്. മാസേന ഉള്ളടക്കം മാറ്റുന്നതിനാൽ ഈ പേജ് ബുക്ക്മാർക്ക് ചെയ്ത് ഇടയ്ക്ക് പരിശോധിക്കുന്നതാണ് ഏറ്റവും നല്ലത്.
### 📣 അറിയിപ്പ് - പുതിയ GitHub Copilot Agent മോഡ് വെല്ലുവിളികൾ പൂർത്തിയാക്കുക!
പുതിയ വെല്ലുവിളി ചേർത്തു, "GitHub Copilot Agent Challenge 🚀" എന്നതു കൂടുതലായുള്ള അദ്ധ്യായങ്ങളിൽ കാണാം. GitHub Copilot, Agent മോഡ് ഉപയോഗിച്ച് പൂർത്തിയാക്കാനുള്ള പുതിയ വെല്ലുവിളിയാണ് ഇത്. മുൻപ് Agent മോഡ് ഉപയോഗിച്ചിട്ടില്ലെങ്കിൽ, ഇത് തവണ കൂടാതെ എഴുത്ത് സൃഷ്ടിക്കാനും ഫയലുകൾ സൃഷ്ടിക്കാനും സെങ്കിൽ എഡിറ്റ് ചെയ്യാനും, കമാൻഡ് ഓടിക്കാനും കഴിയും.
### 📣 അറിയിപ്പ് - _Generative AI ഉപയോഗിച്ച് പുതിയ പ്രോജക്ട്_
പുതിയ AI Assistant പ്രോജക്ട് ചേർത്തു, ഇത് പരിശോധിക്കുക [project](./9-chat-project/README.md)
### 📣 അറിയിപ്പ് - _JavaScript നു വേണ്ടി പുതിയ Generative AI കോറിക്കുല_
പുതിയ Generative AI കോറിക്കുലം നഷ്ടപ്പെടുത്തേണ്ടതില്ല!
ആരംഭിക്കാൻ സന്ദർശിക്കുക [https://aka.ms/genai-js-course](https://aka.ms/genai-js-course)!
![Background](../../translated_images/background.148a8d43afde5730.ml.png)
- അടിസ്ഥാന കാര്യങ്ങളിൽ നിന്നാരംഭിച്ച് RAG വരെ ഉൾക്കൊള്ളുന്ന പാഠങ്ങൾ.
- GenAIയു നമ്മുടെ സഹപാഠിയുള്ള ആപ്പും ഉപയോഗിച്ച് ചരിത്രപ്രസിദ്ധ വ്യക്തികളുമായി തൽസമയ സംവാദം.
- രസകരമായ കഥാരൂപകഥ, നിങ്ങൾകാലയാത്ര ചെയ്യുന്നു!
![character](../../translated_images/character.5c0dd8e067ffd693.ml.png)
ഓരോ പാഠത്തിലും പൂർത്തിയാക്കാനുള്ള അസൈൻമെന്റ്, അറിവ് പരിശോധന, വെല്ലുവിളി എന്നിവയുണ്ട്, പഠിക്കാനുള്ള വിഷയങ്ങൾ ഉൾക്കൊള്ളുന്നു:
- പ്രോമ്പ്റ്റിംഗ് ആൻഡ് പ്രോമ്പ്റ്റ് എഞ്ചിനീയറിങ്
- ടെക്സ്റ്റ് ആൻഡ് ഇമേജ് ആപ്പ് സൃഷ്ടി
- തിരച്ചിൽ ആപ്പുകൾ
ആരംഭിക്കാൻ സന്ദർശിക്കുക [https://aka.ms/genai-js-course](../../[https:/aka.ms/genai-js-course)
## 🌱 തുടക്കം
> **അധ്യാപകർ**, ഈ കോറിക്കുലം ഉപയോഗിക്കാനുള്ള ചില നിർദ്ദേശങ്ങൾ ഞങ്ങൾ [ഉൾപ്പെടുത്തി](for-teachers.md). നിങ്ങളുടെ പ്രതികരണങ്ങൾ ഞങ്ങളുടെ [ചർച്ച ഫോറത്തിൽ](https://github.com/microsoft/Web-Dev-For-Beginners/discussions/categories/teacher-corner) അറിയിക്കൂ!
**[വിദ്യാർത്ഥികൾ](https://aka.ms/student-page/?WT.mc_id=academic-77807-sagibbon)**, ഓരോ പാഠത്തിനും മുമ്പ് പ്രീ-ലെക്ചർ ക്വിസ്സ് ചെയ്യുക, തുടർന്ന് ലെക്ചർ മെറ്റീരിയൽ വായിക്കുകയും വിവിധ പ്രവർത്തനങ്ങൾ പൂർത്തിയാക്കുകയും പോസ്റ്റ്-ലെക്ചർ ക്വിസ് മൂല്യాంకനം നടത്തുകയും ചെയ്യുക.
കൂടുതൽ പഠനാനുഭവം മെച്ചപ്പെടുത്താൻ, പ്രോജക്ടുകളിൽ ഒന്നിച്ച് പ്രവർത്തിക്കാൻ നിങ്ങളുടെ കൂട്ടുകാരുമായി ബന്ധപ്പെടുക! ചർച്ചകൾ ഞങ്ങളുടെ [ചർച്ച ഫോറത്തിൽ](https://github.com/microsoft/Web-Dev-For-Beginners/discussions) സ്വീകാര്യമാണ്, അവിടെ हमारे മോദറേറ്റർ ടീമംഗങ്ങൾ നിങ്ങളുടെ ചോദ്യങ്ങൾക്ക് ഉത്തരം നൽകാൻ സജ്ജമാണ്.
കൂടുതൽ വിദ്യാഭ്യാസത്തിനായി, അധിക പഠന സാമഗ്രികൾക്കായി [Microsoft Learn](https://learn.microsoft.com/users/wirelesslife/collections/p1ddcy5jwy0jkm?WT.mc_id=academic-77807-sagibbon) ആന്പധി പരിശോധിക്കാൻ ഞങ്ങൾ ശക്തമായി ശിപാർശ ചെയ്യുന്നു.
### 📋 നിങ്ങളുടെ പരിസരം ക്രമീകരിക്കൽ
ഈ കോറിക്കുലത്തിനായി ഒരു വികസന പരിസരം തയ്യാറായിട്ടുണ്ട്! നിങ്ങൾ തുടങ്ങുമ്പോൾ [Codespace](https://github.com/features/codespaces/) (ബ്രൗസർ അടിസ്ഥാനവും, ഇൻസ്റ്റാൾ വേണ്ടാത്ത പരിസരം) ഉപയോഗിക്കാനോ, അല്ലെങ്കിൽ നിങ്ങളുടെ കമ്പ്യൂട്ടറിൽ [Visual Studio Code](https://code.visualstudio.com/?WT.mc_id=academic-77807-sagibbon) പോലുള്ള ഒരു ടെക്സ്റ്റ് എഡിറ്റർ ഉപയോഗിക്കാനോ കഴിയും.
#### നിങ്ങളുടെ റിപോസിറ്ററി സൃഷ്ടിക്കുക
നിങ്ങളുടെ ജോലി എളുപ്പത്തിൽ സേവ് ചെയ്യാൻ, ഈ റിപോസിറ്ററി സ്വന്തം അത്രപകർപ്പ് സൃഷ്ടിക്കാൻ ശുപാർശ ചെയ്യുന്നു. പേജിന്റെ മുകളിൽ കാണുന്ന **Use this template** ബട്ടൺ ക്ലിക്ക് ചെയ്താല്‍ നിങ്ങള്‍ക്ക് നിങ്ങളുടെ GitHub അക്കൗണ്ടിൽ പുതിയ ഒരു റിപോസിറ്ററി നിർമ്മിക്കാം, ഇതിൽ കോറിക്കുലംയുടെ പകർപ്പ് അടങ്ങിയിരിക്കും.
ഈ ഘട്ടങ്ങൾ പിന്തുടരുക:
1. **റിപോസിറ്ററി ഫോർക്കുചെയ്യുക**: ഈ പേജിന്റെ മുകളിലുള്ള വലത് വശത്തുള്ള "Fork" ബട്ടൺ ക്ലിക്ക് ചെയ്യുക.
2. **റിപോസിറ്ററി ക്ലോൺ ചെയ്യുക**: `git clone https://github.com/microsoft/Web-Dev-For-Beginners.git`
#### Codespace ൽ കോറിക്കുലം ഓടിക്കുക
നിങ്ങൾ സൃഷ്ടിച്ച റിപോസിറ്ററിയിൽ, **Code** ബട്ടൺ ക്ലിക്ക് ചെയ്ത് **Open with Codespaces** തിരഞ്ഞെടുക്കുക. പുതിയ ഒരു Codespace നിങ്ങൾക്കായി സൃഷ്ടിക്കും.
![Codespace](../../translated_images/createcodespace.0238bbf4d7a8d955.ml.png)
#### നിങ്ങളുടെ കമ്പ്യൂട്ടറിൽ കോറിക്കുലം ലോക്കലായി ഓടിക്കുക
ഈ കോറിക്കുലം നിങ്ങളുടെ കമ്പ്യൂട്ടറിൽ ലോക്കലായി ഓടിക്കാൻ, ഒരു ടെക്സ്റ്റ് എഡിറ്റർ, ഒരു ബ്രൗസർ, ഒരു കമാൻഡ് ലൈൻ ഉപകരണം എന്നിവ ആവശ്യമാണ്. നമ്മുടെ ആദ്യ പാഠമായ [Introduction to Programming Languages and Tools of the Trade](../../1-getting-started-lessons/1-intro-to-programming-languages) നിങ്ങൾക്കായി ഓരോ ടൂളിനും ലഭ്യമായ ഓപ്ഷനുകൾ വിശദീകരിക്കുന്നു.
നിങ്ങളുടെ എഡിറ്ററായി [Visual Studio Code](https://code.visualstudio.com/?WT.mc_id=academic-77807-sagibbon) ഉപയോഗിക്കാൻ ഞങ്ങൾ ശിപാർശ ചെയ്യുന്നു, ഇതിൽ തന്നെ [Terminal](https://code.visualstudio.com/docs/terminal/basics/?WT.mc_id=academic-77807-sagibbon) ബിൽറ്റ്-ഇൻ ആയി ഉണ്ട്. Visual Studio Code ഇവിടെ നിന്ന് ഡൗൺലോഡ് ചെയ്യാം [ഇവിടെ](https://code.visualstudio.com/?WT.mc_id=academic-77807-sagibbon).
1. നിങ്ങളുടെ റിപോസിറ്ററി നിങ്ങളുടെ കമ്പ്യൂട്ടറിലേക്ക് ക്ലോൺ ചെയ്യുക. ഇത് ചെയ്യാൻ, **Code** ബട്ടൺ ക്ലിക്ക് ചെയ്ത് URL പകർപ്പിക്കുക:
[CodeSpace](./images/createcodespace.png)
അപ്പോൾ, [Visual Studio Code](https://code.visualstudio.com/?WT.mc_id=academic-77807-sagibbon)യിൽ [Terminal](https://code.visualstudio.com/docs/terminal/basics/?WT.mc_id=academic-77807-sagibbon) തുറന്ന്, നിങ്ങൾക്ക് تازهപ്പുൽ किया url-ഇനായി `<your-repository-url>` മാറ്റി താഴെ കാണിക്കുന്ന കമാൻഡ് റൺ ചെയ്യുക:
```bash
git clone <your-repository-url>
```
2. Visual Studio Code-ൽ ഫോൾഡർ തുറക്കുക. ഇത് ചെയ്യാൻ **File** > **Open Folder** ക്ലിക്ക് ചെയ്ത് നിങ്ങൾ ക്ലോൺ ചെയ്ത ഫോൾഡർ തിരഞ്ഞെടുക്കുക.
> ശുപാർശ ചെയ്യപ്പെട്ട Visual Studio Code എക്സ്റ്റൻഷനുകൾ:
>
> * [Live Server](https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer&WT.mc_id=academic-77807-sagibbon) - Visual Studio Code-ൽ HTML പേജുകൾ മുൻകാഴ്ച്ച ചെയ്യാൻ
> * [Copilot](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot&WT.mc_id=academic-77807-sagibbon) - കോഡ് വേഗത്തിൽ എഴുതാനായി സഹായിക്കാൻ
## 📂 ഓരോ പാഠവും ഉൾക്കൊള്ളുന്നത്:
- ഓപ്ഷണൽ സ്കെച്ച്നോട്ട്
- ഓപ്ഷണൽ സെപ്ലിമെന്റൽ വീഡിയോ
- പാഠം മുമ്പുള്ള വാറ്മപ്പ് ക്വിസ്
- എഴുതിയ പാഠം
- പ്രോജക്ട് അടിസ്ഥാനത്തിലുള്ള പാഠങ്ങൾക്ക് പ്രോജക്ട് നിർമ്മിക്കുന്നതിനുള്ള കാൽവെയിലുകൾ
- നോളജ് ചെക്കുകൾ
- ഒരു ചലഞ്ച്
- അനുബന്ധ വായന
- അസൈൻമെന്റ്
- [പോസ്റ്റ്-പാഠം ക്വിസ്](https://ff-quizzes.netlify.app/web/)
> **ക്വിസ്സുകൾക്കുറിച്ചുള്ള ഒരു കുറിപ്പ്**: എല്ലാ ക്വിസ്സുകളും Quiz-app ഫോൾഡറിലെ ഉള്ളതാണ്, ഓരോന്നിൽ മൂന്ന് ചോദ്യങ്ങളോടുകൂടിയ 48 ക്വിസ്സ് ഉണ്ട്. അവ [ഇവിടെ](https://ff-quizzes.netlify.app/web/) ലഭ്യമാണ്. ക്വിസ് ആപ്പ് ലോക്കലായി റൺ ചെയ്യാം അല്ലെങ്കിൽ Azure-ലേക്ക് ഡിപ്ലോയുചെയ്യാം; നിര്‍ദേശങ്ങള്‍ `quiz-app` ഫോൾഡറില്‍ കാണുക.
## 🗃️ പാഠങ്ങൾ
| | പ്രോജക്ട് നാമം | പഠിപ്പിച്ച ആശയങ്ങൾ | പഠന ലക്ഷ്യങ്ങൾ | ബന്ധമുള്ള പാഠം | ലേഖകൻ |
| :-: | :------------------------------------------------------: | :--------------------------------------------------------------------: | ----------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------: | :---------------------: |
| 01 | തുടക്കം കുറിക്കുന്നു | പ്രോഗ്രാമിംഗ് പരിചയം, വാടക സാധനങ്ങൾ | പല പ്രോഗ്രാമിംഗ് ഭാഷകളുടെ അടിസ്ഥാന ഘടനകളും പ്രൊഫഷണൽ ഡെവലപ്പർമാര്‍ക്ക് സഹായം ചെയ്യുന്നതുമായ സോഫ്റ്റ്‌വയറുകൾ പഠിക്കുക | [Intro to Programming Languages and Tools of the Trade](./1-getting-started-lessons/1-intro-to-programming-languages/README.md) | ജാസ്മിൻ |
| 02 | തുടക്കം കുറിക്കുന്നു | GitHub അടിസ്ഥാനങ്ങൾ, ടീംവർക്കിനുള്ള പ്രവർത്തനം | നിങ്ങളുടെ പ്രോജക്ടിൽ GitHub ഉപയോഗിക്കുകയും മറ്റു കോഡുകളും സഹകരിച്ച് ഉപയോഗിക്കാനും പഠിക്കുക | [Intro to GitHub](./1-getting-started-lessons/2-github-basics/README.md) | ഫ്ലോർ |
| 03 | തുടക്കം കുറിക്കുന്നു | ആക്സസ്ബിലിറ്റി | വെബ് ആക്സസ്ബിലിറ്റി അടിസ്ഥാനങ്ങൾ പഠിക്കുക | [Accessibility Fundamentals](./1-getting-started-lessons/3-accessibility/README.md) | ക്രിസ്റ്റോഫർ |
| 04 | JS ബേസിക്സ് | ജാവാസ്ക്രിപ്റ്റ് ഡാറ്റാ ടൈപ്പുകൾ | ജാവാസ്ക്രിപ്റ്റ് ഡാറ്റാ ടൈപ്പുകളുടെ അടിസ്ഥാനങ്ങൾ | [Data Types](./2-js-basics/1-data-types/README.md) | ജാസ്മിൻ |
| 05 | JS ബേസിക്സ് | ഫംഗ്ഷനുകൾ, മെത്തഡുകൾ | ഒരു ആപ്ലിക്കേഷൻ ലജിക് ഫ്ലോ നിയന്ത്രിക്കാൻ ഫംഗ്ഷനുകളും മെത്തഡുകളും പഠിക്കുക | [Functions and Methods](./2-js-basics/2-functions-methods/README.md) | ജാസ്മിൻ, ക്രിസ്റ്റോഫർ |
| 06 | JS ബേസിക്സ് | ജാവാസ്ക്രിപ്റ്റിലൂടെ തീരുമാനം എടുക്കൽ | നിർദ്ദേശങ്ങൾ സൃഷ്ടിക്കുന്ന രീതികൾ പഠിക്കുക | [Making Decisions](./2-js-basics/3-making-decisions/README.md) | ജാസ്മിൻ |
| 07 | JS ബേസിക്സ് | അറേസും ലൂപ്പുകളും | ജാവാസ്ക്രിപ്റ്റിൽ അറേയും ലൂപ്പുകളും ഉപയോഗിച്ചു ഡാറ്റ കൈകാര്യം ചെയ്യുക | [Arrays and Loops](./2-js-basics/4-arrays-loops/README.md) | ജാസ്മിൻ |
| 08 | [ടെറേരിയം](./3-terrarium/solution/README.md) | HTML പ്രയോഗം | ഓൺലൈൻ ടെറേരിയം സൃഷ്ടിക്കാൻ HTML നിർമ്മിക്കുക, ലേഔട്ട് നിർമ്മിക്കുന്നതിൽ ശ്രദ്ധ കേന്ദ്രീകരിക്കുക | [Introduction to HTML](./3-terrarium/1-intro-to-html/README.md) | ജെൻ |
| 09 | [ടെറേരിയം](./3-terrarium/solution/README.md) | CSS പ്രയോഗം | ഓൺലൈൻ ടെറേരിക്ക CSS സ്റ്റൈൽ നൽകുക; പേജ് റെസ്പോൺസീവ് ആക്കുന്നതിൽ അടിസ്ഥാനങ്ങൾ ഉൾകൊള്ളുക | [Introduction to CSS](./3-terrarium/2-intro-to-css/README.md) | ജെൻ |
| 10 | [ടെറേരിയം](./3-terrarium/solution/README.md) | ജാവാസ്ക്രിപ്റ്റ് ക്ലോസറുകൾ, DOM മാനിപ്പുലേഷൻ | ടെറേരിയം ഒരു ഡ്രാഗ്/ഡ്രോപ്പ് ഇന്റർഫേസ് ആയി പ്രവർത്തിക്കാൻ ജാവാസ്ക്രിപ്റ്റ് നിർമ്മിക്കുക, ക്ലോസറുകളും DOM മാനിപ്പുലേഷനും ശ്രദ്ധിക്കുക | [JavaScript Closures, DOM manipulation](./3-terrarium/3-intro-to-DOM-and-closures/README.md) | ജെൻ |
| 11 | [ടൈപ്പിംഗ് ഗെയിം](./4-typing-game/solution/README.md) | ടൈപ്പിംഗ് ഗെയിം നിർമ്മിക്കുക | ജാവാസ്ക്രിപ്റ്റ് ആപ്ലിക്കേഷൻ ലജിക് ചലിപ്പിക്കാൻ കീബോർഡ് ഇവന്റുകൾ ഉപയോഗിക്കുക | [Event-Driven Programming](./4-typing-game/typing-game/README.md) | ക്രിസ്റ്റോഫർ |
| 12 | [ഗ്രീൻ ബ്രൗസ് എക്സ്റ്റൻഷൻ](./5-browser-extension/solution/README.md) | ബ്രൗസറുകളുടെ പ്രവർത്തനം | ബ്രൗസറുകൾ എങ്ങനെ പ്രവർത്തിക്കുന്നു, അവയുടെ ചരിത്രം, ഒരു ബ്രൗസർ എക്സ്റ്റൻഷന്റെ ആദ്യ ഘടകങ്ങൾ നിർമ്മിക്കുന്നത് പഠിക്കുക | [About Browsers](./5-browser-extension/1-about-browsers/README.md) | ജെൻ |
| 13 | [ഗ്രീൻ ബ്രൗസ് എക്സ്റ്റൻഷൻ](./5-browser-extension/solution/README.md) | ഫാർം നിർമ്മിച്ചു API വിളിച്ച് ലോക്കൽ സ്റ്റോറേജിൽ തരങ്ങൾ സൂക്ഷിക്കൽ | API വിളിക്കാനായി ബ്രൗസർ എക്സ്റ്റൻഷന്റെ ജാവാസ്ക്രിപ്റ്റ് ഘടകങ്ങൾ നിർമ്മിക്കുക, ലോക്കൽ സ്റ്റോറേജിൽ സൂക്ഷിച്ചിട്ടുള്ള തരങ്ങൾ ഉപയോഗിച്ചു | [APIs, Forms, and Local Storage](./5-browser-extension/2-forms-browsers-local-storage/README.md) | ജെൻ |
| 14 | [ഗ്രീൻ ബ്രൗസ് എക്സ്റ്റൻഷൻ](./5-browser-extension/solution/README.md) | ബ്രൗസറിലെ പശ്ചാത്തല പ്രോസസ്സുകൾ, വെബ് പ്രകടനം | എക്സ്റ്റൻഷന്റെ ഐക്കൺ മാനേജുചെയ്യാൻ ബ്രൗസറിന്റെ പശ്ചാത്തല പ്രോസസ്സുകൾ ഉപയോഗിക്കുക; വെബ് പ്രകടനവും കുറച്ച് മെച്ചപ്പെടുത്തലുകളും പഠിക്കുക | [Background Tasks and Performance](./5-browser-extension/3-background-tasks-and-performance/README.md) | ജെൻ |
| 15 | [സ്പേസ് ഗെയിം](./6-space-game/solution/README.md) | ജാവാസ്ക്രിപ്റ്റ് ഉപയോഗിച്ച് കൂടുതൽ പുരോഗമിച്ച ഗെയിം വികസനം | ക്ലാസ്സുകളും കോംപോസിഷനും ഉപയോഗിച്ച ഈറിറ്റൻസിന്റെയും പബ്ലിഷ്/സബ്സ്ക്രൈബ് പാറ്റേണിന്റെയും പഠനം, ഗെയിം നിർമ്മാണത്തിനുള്ള ഒരുക്കം | [Introduction to Advanced Game Development](./6-space-game/1-introduction/README.md) | ക്രിസ് |
| 16 | [സ്പേസ് ഗെയിം](./6-space-game/solution/README.md) | ക്യാൻവാസ് ലേഖനം | എന്തൊക്കെ സ്‌ക്രീനിലേക്ക് വരയ്ക്കാനായി ക്യാൻവാസ് API ഉപയോഗം | [Drawing to Canvas](./6-space-game/2-drawing-to-canvas/README.md) | ക്രിസ് |
| 17 | [സ്പേസ് ഗെയിം](./6-space-game/solution/README.md) | സ്‌ക്രീനിലെ ഘടകങ്ങൾ സഞ്ചരിക്കൽ | ഘടകങ്ങൾക്ക് ചലനം ലഭിക്കുന്ന രീതി കാർട്ടീഷ്യൻ കോഓർഡിനേറ്റുകളും ക്യാൻവാസ് API-ഉം ഉപയോഗിച്ച് അറിയുക | [Moving Elements Around](./6-space-game/3-moving-elements-around/README.md) | ക്രിസ് |
| 18 | [സ്പേസ് ഗെയിം](./6-space-game/solution/README.md) | ഏറ്റുമുട്ടൽ കണ്ടെത്തൽ | ഘടകങ്ങൾ തമ്മിൽ പട്ട്, കീപ്രസ്സ് ഉപയോഗിച്ച് പ്രതികരതുകയും ഗെയിം പ്രകടനത്തിനായി കൂൾഡൗൺ ഫംഗ്ഷൻ നൽകുകയും ചെയ്യുക | [Collision Detection](./6-space-game/4-collision-detection/README.md) | ക്രിസ് |
| 19 | [സ്പേസ് ഗെയിം](./6-space-game/solution/README.md) | സ്‌കോർ സൂക്ഷിക്കൽ | ഗെയിം സ്റ്റാറ്റസും പ്രകടനത്തിനും അടിസ്ഥാനമാക്കിയുള്ള ഗണിത കണക്കുകൂട്ടലുകൾ നടത്തുക | [Keeping Score](./6-space-game/5-keeping-score/README.md) | ക്രിസ് |
| 20 | [സ്പേസ് ഗെയിം](./6-space-game/solution/README.md) | ഗെയിം അവസാനിപ്പിച്ച് വീണ്ടും ആരംഭിക്കൽ | ഗെയിം അവസാനിപ്പിക്കൽ, റീസ്റ്റാർട്ട് ചെയ്യൽ, ആസ്തികൾ ശുചീകരിക്കുക, വേരിയബിൾ മൂല്യങ്ങൾ പുനഃസജ്ജീകരിക്കുക പഠിക്കുക | [The Ending Condition](./6-space-game/6-end-condition/README.md) | ക്രിസ് |
| 21 | [ബാങ്കിംഗ് ആപ്പ്](./7-bank-project/solution/README.md) | വെബ് ആപ്പിൽ HTML ടേംപ്ലേറ്റുകളും റൂട്ടുകളും | മൾട്ടിപേജ് വെബ്സൈറ്റിന്റെ ആർക്കിടെക്ചർ സൃഷ്ടിക്കാൻ റൂട്ടിംഗും HTML ടേംപ്ലേറ്റുകളും ഉപയോഗിച്ച് Scaffold നിർമ്മിക്കുക | [HTML Templates and Routes](./7-bank-project/1-template-route/README.md) | യോഗൻ |
| 22 | [ബാങ്കിംഗ് ആപ്പ്](./7-bank-project/solution/README.md) | ലോഗിൻ, രജിസ്ട്രേഷൻ ഫോം നിർമ്മിക്കുക | ഫോം നിർമ്മാണവും വാലിഡേഷൻ റൂട്ടീനുകളും പഠിക്കുക | [Forms](./7-bank-project/2-forms/README.md) | യോഗൻ |
| 23 | [ബാങ്കിംഗ് ആപ്പ്](./7-bank-project/solution/README.md) | ഡാറ്റ ഏറി വാങ്ങുന്നതിന്റെയും ഉപയോഗത്തിന്റെയും രീതികൾ | ആപ്പിൽ ഡാറ്റ എളുപ്പത്തിൽ എടുക്കാനും സൂക്ഷിക്കാനുമായും ഉപയോഗിക്കുകയും ചെയ്യുന്നതെങ്ങനെ | [Data](./7-bank-project/3-data/README.md) | യോഗൻ |
| 24 | [ബാങ്കിംഗ് ആപ്പ്](./7-bank-project/solution/README.md) | സ്റ്റേറ്റ് മാനേജ്മെന്റ് ആശയങ്ങൾ | നിങ്ങളുടെ ആപ്പ് സ്റ്റേറ്റ് എങ്ങനെ നിലനിർത്തുകയും പ്രോഗ്രാമാറ്റിക്കായി എങ്ങനെ മാനേജുചെയ്യുകയും ചെയ്യുന്നു എന്ന് പഠിക്കുക | [State Management](./7-bank-project/4-state-management/README.md) | യോഗൻ |
| 25 | [Browser/VScode Code](../../8-code-editor) | VScode ഉപയോഗം | കോഡ് എഡിറ്റർ ഉപയോഗിക്കുന്ന വിധം പഠിക്കുക| [Use VScode Code Editor](./8-code-editor/1-using-a-code-editor/README.md) | ക്രിസ് |
| 26 | [AI അസിസ്റ്റന്റുകൾ](./9-chat-project/README.md) | AI ഉപയോഗം | നിങ്ങളുടെ സ്വന്തം AI അസിസ്റ്റന്റ് നിർമ്മിക്കാൻ പഠിക്കുക | [AI Assistant project](./9-chat-project/README.md) | ക്രിസ് |
## 🏫 പാഠ്യരീതിശാസ്ത്രം
നമ്മുടെ സിലബസ് രണ്ട് പ്രധാന പാഠ്യരീതിശാസ്ത്ര അടിസ്ഥാനങ്ങളോടെയാണ് രൂപപ്പെടുത്തിയിരിക്കുന്നത്:
* പ്രോജക്ട് അടിസ്ഥാന പഠനം
* വീണ്ടും വീണ്ടും ക്വിസ്സുകൾ
ജാവാസ്ക്രിപ്റ്റ്, HTML, CSS-ന്റെ അടിസ്ഥാനങ്ങളും ഇന്നത്തെ വെബ് ഡെവലപ്പർമാർ ഉപയോഗിക്കുന്ന ഏറ്റവും പുതിയ ഉപകരണങ്ങളും സാങ്കേതിക വിദ്യകളും ഈ പ്രോഗ്രാം പഠിപ്പിക്കുന്നു. ടൈപ്പിംഗ് ഗെയിം, വെർച്ച്വൽ ടെറേരിക്കം, പച്ചപ്പെട്ട ബ്രൗസർ എക്സ്റ്റൻഷൻ, സ്പേസ്-ഇൻവേഡർ സ്റ്റൈൽ ഗെയിം, ബിസിനസ്用 ബാങ്കിംഗ് ആപ്പ് തുടങ്ങി വിവിധ പ്രോജക്ടുകൾ നിർമ്മിച്ച് പ്രായോഗിക പരിചയം നേടാൻ വിദ്യാർത്ഥികൾക്ക് അവസരം ലഭിക്കും. പരമ്പരയുടെ അവസാനം, വിദ്യാർത്ഥികൾ വെബ് ഡെവലപ്‌മെന്റിന്റെ ശക്തമായ അവബോധം നേടിയിരിക്കുമെന്ന് ഉറപ്പ്.
> 🎓 ഈ പാഠ്യപദ്ധതിയിലെ ആദ്യ പാഠങ്ങൾ Microsoft Learn-ൽ [Learn Path](https://docs.microsoft.com/learn/paths/web-development-101/?WT.mc_id=academic-77807-sagibbon) എന്ന രൂപത്തിൽ പഠിക്കാം!
വിഷയങ്ങൾ പ്രോജക്ടുകളുമായി ഏകോപിപ്പിക്കുന്നതിലൂടെ വിദ്യാർത്ഥികൾക്ക് പഠനം കൂടുതൽ ആകർഷകവും ആശയങ്ങൾ മനസ്സിലാക്കൽ മെച്ചപ്പെടുത്തുന്നതുമായിരിക്കുമെന്ന് ഉറപ്പുവരുത്തുന്നു. ചില തുടങ്ങി പാഠങ്ങൾ ജാവാസ്ക്രിപ്റ്റ് അടിസ്ഥാനങ്ങളിൽ എഴുതിയിട്ടുണ്ട്, "[ബിഗിൻസേഴ്സ് സീരീസ് ടു: ജാവാസ്ക്രിപ്റ്റ്](https://channel9.msdn.com/Series/Beginners-Series-to-JavaScript/?WT.mc_id=academic-77807-sagibbon)" വീഡിയോ ട്യൂട്ടോറിയൽ ശേഖരത്തിലെ ഒരു വീഡിയോയും ഉൾപ്പെടുത്തിയാണ്; ഇതിന്റെ ചില ലേഖകർ ഈ പാഠ്യപദ്ധതിയിലേക്കും സഹകരിച്ചിട്ടുണ്ട്.
ക്ലാസ് തുടങ്ങുന്നതിന് മുമ്പുള്ള ഒരു കുറച്ച് ക്വിസ് വിദ്യാർത്ഥിയുടെ പഠന ലക്ഷ്യത്തെ നിർണയിക്കാനും ക്ലാസ് കഴിഞ്ഞ് മറ്റൊരു ക്വിസ് അറിവിന്റെ ഉറപ്പ് നൽകാനും സഹായിക്കുന്നു. ഈ സിലബസ് ഫ്ലെക്സിബിള്‍ ആയും രസകരവുമാണ്, മുഴുവൻ അല്ലെങ്കിൽ ഭാഗികമായി സ്വീകരിക്കാം. പ്രോജക്ടുകൾ ചെറിയതുതന്നെ ആരംഭിച്ച് 12 ആഴ്ച കാലയളവിന്റെ അവസാനത്തിലെങ്കിൽ സങ്കീർണ്ണവും നവീനവുമായവയാവും.
ഫ്രെയിംവർക്ക് അവതരിപ്പിക്കുന്നതിൽ നിന്നും ലഘുത്വം നോക്കിക്കൊണ്ട് വെബ് ഡെവലപ്പർക്ക് ആവശ്യമായ അടിസ്ഥാനമുൻകെട്ടുകളെക്കുറിച്ചു ശ്രദ്ധ കേന്ദ്രീകരിച്ചിരുന്നുവെങ്കിലും, ഈ സിലബസ് പൂർത്തിയാക്കാനായി അടുത്തത് "[ബിഗിൻസേഴ്സ് സീരിസ് ടു: Node.js](https://channel9.msdn.com/Series/Beginners-Series-to-Nodejs/?WT.mc_id=academic-77807-sagibbon)" വീഡിയോ ശേഖരം കൂടി പഠിക്കുക എന്നതാണ് നല്ലത്.
> ഞങ്ങളുടെ [*Code of Conduct*](CODE_OF_CONDUCT.md)യും [*Contributing*](CONTRIBUTING.md) മാർഗനിർദേശങ്ങളും സന്ദർശിക്കുക. നിങ്ങളുടെ ഗുണപരമായ സുഹൃത്തുക്കൾ ഞങ്ങൾക്ക് സ്വാഗതമാണ്!
## 🧭 ഓഫ്‌ലൈൻ ആക്‌സസ്
[Docsify](https://docsify.js.org/#/) ഉപയോഗിച്ച് നിങ്ങൾക്ക് ഈ ഡോക്യുമെന്റേഷൻ ഓഫ്‌ലൈൻ ആക്കാം. ഈ റിപൊ ഫോർക്ക് ചെയ്ത്, നിങ്ങളുടെ ലോക്കൽ യന്ത്രത്തിൽ [Docsify ഇൻസ്റ്റാൾ](https://docsify.js.org/#/quickstart) ചെയ്യുക, പിന്നെ ഈ റിപൊയുടെ റൂട്ട് ഫോൾഡറിൽ `docsify serve` എന്ന് ടൈപ്പ് ചെയ്‌താൽ വെബ്‌സൈറ്റ് ലൊക്കൽഹോസ്റ്റിൽ പോർട്ട് 3000-ൽ സേർവ് ചെയ്യും: `localhost:3000`.
## 📘 PDF
എല്ലാ പാഠങ്ങളും അടങ്ങിയ ഒരു PDF ഇവിടെ ലഭ്യമാണ് [ഇവിടെ](https://microsoft.github.io/Web-Dev-For-Beginners/pdf/readme.pdf).
## 🎒 മറ്റ് കോഴ്സുകൾ
നമ്മളുടെ ടീം മറ്റ് കോഴ്സുകളും നിർമ്മിക്കുന്നു! പരിശോധിക്കുക:
<!-- CO-OP TRANSLATOR OTHER COURSES START -->
### LangChain
[![LangChain4j for Beginners](https://img.shields.io/badge/LangChain4j%20for%20Beginners-22C55E?style=for-the-badge&&labelColor=E5E7EB&color=0553D6)](https://aka.ms/langchain4j-for-beginners)
[![LangChain.js for Beginners](https://img.shields.io/badge/LangChain.js%20for%20Beginners-22C55E?style=for-the-badge&labelColor=E5E7EB&color=0553D6)](https://aka.ms/langchainjs-for-beginners?WT.mc_id=m365-94501-dwahlin)
---
### Azure / Edge / MCP / ഏജന്റുകൾ
[![AZD for Beginners](https://img.shields.io/badge/AZD%20for%20Beginners-0078D4?style=for-the-badge&labelColor=E5E7EB&color=0078D4)](https://github.com/microsoft/AZD-for-beginners?WT.mc_id=academic-105485-koreyst)
[![Edge AI for Beginners](https://img.shields.io/badge/Edge%20AI%20for%20Beginners-00B8E4?style=for-the-badge&labelColor=E5E7EB&color=00B8E4)](https://github.com/microsoft/edgeai-for-beginners?WT.mc_id=academic-105485-koreyst)
[![MCP for Beginners](https://img.shields.io/badge/MCP%20for%20Beginners-009688?style=for-the-badge&labelColor=E5E7EB&color=009688)](https://github.com/microsoft/mcp-for-beginners?WT.mc_id=academic-105485-koreyst)
[![AI Agents for Beginners](https://img.shields.io/badge/AI%20Agents%20for%20Beginners-00C49A?style=for-the-badge&labelColor=E5E7EB&color=00C49A)](https://github.com/microsoft/ai-agents-for-beginners?WT.mc_id=academic-105485-koreyst)
---
### ജനറേറ്റീവ് AI പരമ്പര
[![Generative AI for Beginners](https://img.shields.io/badge/Generative%20AI%20for%20Beginners-8B5CF6?style=for-the-badge&labelColor=E5E7EB&color=8B5CF6)](https://github.com/microsoft/generative-ai-for-beginners?WT.mc_id=academic-105485-koreyst)
[![Generative AI (.NET)](https://img.shields.io/badge/Generative%20AI%20(.NET)-9333EA?style=for-the-badge&labelColor=E5E7EB&color=9333EA)](https://github.com/microsoft/Generative-AI-for-beginners-dotnet?WT.mc_id=academic-105485-koreyst)
[![Generative AI (Java)](https://img.shields.io/badge/Generative%20AI%20(Java)-C084FC?style=for-the-badge&labelColor=E5E7EB&color=C084FC)](https://github.com/microsoft/generative-ai-for-beginners-java?WT.mc_id=academic-105485-koreyst)
[![Generative AI (JavaScript)](https://img.shields.io/badge/Generative%20AI%20(JavaScript)-E879F9?style=for-the-badge&labelColor=E5E7EB&color=E879F9)](https://github.com/microsoft/generative-ai-with-javascript?WT.mc_id=academic-105485-koreyst)
---
### കോർ ലേണിംഗ്
[![ML for Beginners](https://img.shields.io/badge/ML%20for%20Beginners-22C55E?style=for-the-badge&labelColor=E5E7EB&color=22C55E)](https://aka.ms/ml-beginners?WT.mc_id=academic-105485-koreyst)
[![Data Science for Beginners](https://img.shields.io/badge/Data%20Science%20for%20Beginners-84CC16?style=for-the-badge&labelColor=E5E7EB&color=84CC16)](https://aka.ms/datascience-beginners?WT.mc_id=academic-105485-koreyst)
[![AI for Beginners](https://img.shields.io/badge/AI%20for%20Beginners-A3E635?style=for-the-badge&labelColor=E5E7EB&color=A3E635)](https://aka.ms/ai-beginners?WT.mc_id=academic-105485-koreyst)
[![Cybersecurity for Beginners](https://img.shields.io/badge/Cybersecurity%20for%20Beginners-F97316?style=for-the-badge&labelColor=E5E7EB&color=F97316)](https://github.com/microsoft/Security-101?WT.mc_id=academic-96948-sayoung)
[![Web Dev for Beginners](https://img.shields.io/badge/Web%20Dev%20for%20Beginners-EC4899?style=for-the-badge&labelColor=E5E7EB&color=EC4899)](https://aka.ms/webdev-beginners?WT.mc_id=academic-105485-koreyst)
[![IoT for Beginners](https://img.shields.io/badge/IoT%20for%20Beginners-14B8A6?style=for-the-badge&labelColor=E5E7EB&color=14B8A6)](https://aka.ms/iot-beginners?WT.mc_id=academic-105485-koreyst)
[![XR Development for Beginners](https://img.shields.io/badge/XR%20Development%20for%20Beginners-38BDF8?style=for-the-badge&labelColor=E5E7EB&color=38BDF8)](https://github.com/microsoft/xr-development-for-beginners?WT.mc_id=academic-105485-koreyst)
---
### കോപൈലറ്റ് പരമ്പര
[![Copilot for AI Paired Programming](https://img.shields.io/badge/Copilot%20for%20AI%20Paired%20Programming-FACC15?style=for-the-badge&labelColor=E5E7EB&color=FACC15)](https://aka.ms/GitHubCopilotAI?WT.mc_id=academic-105485-koreyst)
[![Copilot for C#/.NET](https://img.shields.io/badge/Copilot%20for%20C%23/.NET-FBBF24?style=for-the-badge&labelColor=E5E7EB&color=FBBF24)](https://github.com/microsoft/mastering-github-copilot-for-dotnet-csharp-developers?WT.mc_id=academic-105485-koreyst)
[![Copilot Adventure](https://img.shields.io/badge/Copilot%20Adventure-FDE68A?style=for-the-badge&labelColor=E5E7EB&color=FDE68A)](https://github.com/microsoft/CopilotAdventures?WT.mc_id=academic-105485-koreyst)
<!-- CO-OP TRANSLATOR OTHER COURSES END -->
## സഹായം ലഭിക്കുന്നത് എങ്ങനെ
നിങ്ങൾ അടഞ്ഞുപോകുകയോ AI ആപ്പുകൾ നിർമ്മിക്കുന്നതിൽ എന്തെങ്കിലും ചോദ്യം ഉണ്ടായിട്ടുണ്ടോ? MCP-യെക്കുറിച്ച് fellow learners-ഉം പരിചയസമ്പന്നരായ ഡെവലപ്പർമാരും കൂടിച്ചേരുന്ന ചര്‍ച്ചകളിൽ ചേർക്കുക. ചോദ്യങ്ങൾ സ്വാഗതം ചെയ്യപ്പെടുന്ന, അറിവ് സ്വതന്ത്രമായി പങ്കുവെക്കപ്പെടുന്ന ഒരു പിന്തുണയുള്ള സമൂഹമാണ് ഇത്.
[![Microsoft Foundry Discord](https://dcbadge.limes.pink/api/server/nTYy5BXMWG)](https://discord.gg/nTYy5BXMWG)
നിങ്ങൾക്ക് ഉത്പന്നത്തെക്കുറിച്ചുള്ള പ്രതികരണങ്ങളോ, നിർമ്മാണത്തിനിടെ സംഭവിക്കുന്ന പിശകുകളോ ഉണ്ടെങ്കിൽ സന്ദർശിക്കുക:
[![Microsoft Foundry Developer Forum](https://img.shields.io/badge/GitHub-Microsoft_Foundry_Developer_Forum-blue?style=for-the-badge&logo=github&color=000000&logoColor=fff)](https://aka.ms/foundry/forum)
## ലൈസൻസ്
ഈ റിപ്പോസിറ്ററി MIT ലൈസൻസിനായി ലൈസൻസിദ്ധമാണ്. കൂടുതൽ വിവരങ്ങൾക്ക് [LICENSE](../../LICENSE) ഫയൽ കാണുക.
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**ഡിസ്ക്ലെയിമർ**:
ഈ ദസ്താവേദം [Co-op Translator](https://github.com/Azure/co-op-translator) എന്ന എഐ അനുഭവത്തിൽ ആണ് വിവർത്തനം ചെയ്തിരിക്കുന്നത്. ഞങ്ങൾ ശരിയായ വിവർത്തനത്തിന് ശ്രമിക്കുന്നു എങ്കിലും, ഓട്ടോമേറ്റഡ് വിവർത്തനങ്ങളിൽ പിഴവുകൾ അല്ലെങ്കിൽ കൃത്യതാ കുറവുകൾ ഉണ്ടായേക്കാമെന്ന് ദയവായി ശ്രദ്ധിക്കുക. സ്വന്തം ഭാഷയിലെ മൗലിക ദസ്താവേദം അതിന്റെ പ്രാമാണികമായ ഉറവിടമായി പരിഗണിക്കണം. നിർണ്ണായകമായ വിവരങ്ങൾക്ക് പ്രൊഫഷണൽ മാനവ വിവർത്തനം ശിപാർശ ചെയ്യുന്നു. ഈ വിവർത്തനം ഉപയോഗിച്ചതിൽ നിന്ന് ഉണ്ടാകുന്ന തെറ്റിദ്ധാരണകൾക്ക് ഞങ്ങൾക്ക് ഉത്തരവാദിത്വം ഇല്ല.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,53 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "4ecc3bf2e27983d4c780be6f26ee6228",
"translation_date": "2026-01-08T10:35:29+00:00",
"source_file": "SECURITY.md",
"language_code": "ml"
}
-->
## സുരക്ഷ
മൈക്രോസോഫ്റ്റ് നമ്മുടെ സോഫ്റ്റ്വെയർ ഉൽപ്പന്നങ്ങളും സേവനങ്ങളും സുരക്ഷിതമാക്കുന്നതിൽ ഗൗരവമായി സമീപിക്കുന്നു, അതിൽ നമ്മുടെ GitHub സംഘടനകളിലൂടെ നിയന്ത്രിക്കുന്ന എല്ലാ സോഴ്‌സ് കോഡ് റെപ്പോസിറ്ററികളും ഉൾപ്പെടുന്നു, അതായത് [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin) എന്നിവയും [നമ്മുടെ GitHub സംഘടനകളും](https://opensource.microsoft.com/?WT.mc_id=academic-77807-sagibbon).
നിങ്ങൾ കണ്ടെത്തിയത് മൈക്രോസോഫ്റ്റ് ഉൾപ്പെട്ട രെപ്പോസിറ്ററികളിൽ [മൈക്രോസോഫ്റ്റിന്റെ സുരക്ഷാ ദുർബ്ബലതയുടെ നിർവചനത്തിന്](https://docs.microsoft.com/previous-versions/tn-archive/cc751383(v=technet.10)/?WT.mc_id=academic-77807-sagibbon) അനുയോജ്യമായ ഒരു സുരക്ഷാ ദുർബ്ബലതയാണ് എന്ന് നിങ്ങൾ വിശ്വസിക്കുന്നുവെങ്കിൽ, താഴെവിവരിച്ച പ്രകാരം ഞങ്ങളോടു റിപ്പോർട്ട് ചെയ്യുക.
## സുരക്ഷാ പ്രശ്‌നങ്ങൾ റിപ്പോർട്ട് ചെയ്യൽ
**ദയവായി സുരക്ഷാ ദുർബ്ബലതകൾ പൊതു GitHub പ്രശ്‌നങ്ങളിലൂടെ റിപ്പോർട്ട് ചെയ്യരുത്.**
പകരം, ദയവായി മൈക്രോസോഫ്റ്റ് സെക്യൂരിറ്റി റെസ്പോൺസ് സെന്റർ (MSRC) യിൽ [https://msrc.microsoft.com/create-report](https://msrc.microsoft.com/create-report/?WT.mc_id=academic-77807-sagibbon) പൊലീസ് റിപ്പോർട്ട് ചെയ്യുക.
ലോഗിൻ ചെയ്യാതെ സമർപ്പിക്കാൻ ആഗ്രഹിക്കുന്നുവെങ്കിൽ, [secure@microsoft.com](mailto:secure@microsoft.com) എന്ന ഇമെയിൽ വിലാസത്തിന് ഇമെയിൽ അയയ്ക്കുക. സാധിക്കുന്നു എങ്കിൽ, ഞങ്ങളുടെ PGP കീ ഉപയോഗിച്ച് നിങ്ങളുടെ സന്ദേശം എൻക്രിപ്റ്റ് ചെയ്യുക; അത് [Microsoft Security Response Center PGP Key പേജിൽ](https://www.microsoft.com/msrc/pgp-key-msrc/?WT.mc_id=academic-77807-sagibbon) നിന്ന് ഡൗൺലോഡ് ചെയ്യുക.
നിങ്ങൾക്ക് 24 മണിക്കൂറിനുള്ളിൽ ഒരു പ്രതികരണം ലഭിക്കുമെന്ന് അനുകൂലിക്കുന്നു. ഏത് കാരണത്താലാകട്ടെ അത് ലഭിക്കുന്നില്ലെങ്കിൽ, നിങ്ങളുടെ ആദ്യ സന്ദേശം ഞങ്ങൾ സ്വീകരിച്ചതായ ഉറപ്പാക്കാൻ ഇമെയിലിലൂടെ ഫോളോ അപ് ചെയ്യുക. കൂടുതൽ വിവരങ്ങൾക്കായി [microsoft.com/msrc](https://www.microsoft.com/msrc/?WT.mc_id=academic-77807-sagibbon) സന്ദർശിക്കുക.
താഴെപ്പെട്ട ആവശ്യമായ വിവരങ്ങൾ (സാധ്യമായത്ര നൽകുക) ഉൾപ്പെടുത്തുക, ഇത് സാധ്യതയുള്ള പ്രശ്‌നം എങ്ങനെ സംഭവിക്കുന്നു എന്നതു മെച്ചമായി മനസിലാക്കാൻ സഹായിക്കും:
* പ്രശ്‌ന തരം (ഉദാഹരണം: ബഫർ ഓവർഫ്ലോ, SQL ഇൻജക്ഷൻ, ക്രോസ്-സൈറ്റ് സ്ക്രിപ്റ്റിംഗ്, തുടങ്ങിയവ)
* പ്രശ്‌നം പ്രകടമാകുന്നതുമായി ബന്ധപ്പെട്ട സോഴ്‌സ് ഫയലുകളുടെ പൂര്‍ണ്ണ പാതകൾ
* ബാധിക്കപ്പെട്ട സോഴ്‌സ് കോഡ് സ്ഥലം (ടാഗ്/ബ്രാഞ്ച്/കമ്മിറ്റ് അല്ലെങ്കിൽ നേരിട്ട് url)
* പ്രശ്‌നത്തിൽ പുനരുറപ്പിക്കല്‍ നടത്താൻ ആവശ്യമായ പ്രത്യേക കോൺഫിഗറേഷൻ
* പ്രശ്‌നം പുനരുറപ്പിക്കൽ നടത്തുന്ന ഘട്ടഘട്ട നിർദ്ദേശങ്ങൾ
* പ്രൂഫ്-ഓഫ്-കോൻസെപ്റ്റ് അല്ലെങ്കിൽ എക്സ്പ്ലോയിറ്റ് കോഡ് (സാധ്യമായെങ്കിൽ)
* പ്രശ്‌നത്തിന്റെ സ്വാധീനം, പിടികൂടുന്നവൻ ഇത് എങ്ങനെ ഉപയോഗപ്പെടുത്താമെന്ന് ഉൾപ്പെടെ
ഈ വിവരങ്ങൾ നിങ്ങളുടെ റിപ്പോർട്ട് വേഗത്തിൽ നമുക്ക് പരിശോധിക്കാൻ സഹായിക്കും.
ബഗ് ബൗണ്ടിക്ക് വേണ്ടി റിപ്പോർട്ട് ചെയ്യുന്നുവെങ്കിൽ, കൂടുതൽ സമ്പൂർണമായ റിപ്പോർട്ടുകൾ കൂടുതൽ വലിയ ബൗണ്ടിയുടെ അവാർഡ് നൽകുന്നതിന് സഹായിക്കും. ഞങ്ങളുടെ [Microsoft Bug Bounty Program](https://microsoft.com/msrc/bounty/?WT.mc_id=academic-77807-sagibbon) പേജ് മുഖാന്തിരം പ്രവർത്തനപ്രദമായ പ്രോഗ്രാമുകൾക്ക് കൂടുതൽ വിവരങ്ങൾ ലഭിക്കും.
## മുൻഗണന ലഭ്യമായ ഭാഷകൾ
എല്ലാ ആശയവിനിമയങ്ങളും ഇംഗ്ലീഷിൽ നടക്കുന്നതാണ് ഞങ്ങളുടെ പേര്.
## നയം
മൈക്രോസോഫ്റ്റ് [Coordinated Vulnerability Disclosure](https://www.microsoft.com/msrc/cvd/?WT.mc_id=academic-77807-sagibbon) എന്ന സിദ്ധാന്തം പാലിക്കുന്നു.
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**പരിഹാരം**:
ഈ രേഖ AI ഭാഷാന്തര സേവനം [Co-op Translator](https://github.com/Azure/co-op-translator) ഉപയോഗിച്ച് ഭാഷാന്തരമാക്കിയതാണ്. ഞങ്ങൾ യഥാർത്ഥതയ്ക്കായി പരിശ്രമിച്ചെങ്കിലും, സ്വയംചാലിത ഭാഷാന്തരത്തിൽ പിശകുകളും അസാധുവായതും ഉണ്ടാകാമെന്ന് ദയവായി ശ്രദ്ധിക്കുക. മാതൃഭാഷയിലുള്ള അർഥസൂചനയാണ് പ്രാമാണികമായ ഉറവിടം. നിർണായക വിവരങ്ങൾക്കായി പ്രൊഫഷണൽ മാനവ ഭാഷാന്തരം ശുപാർശ ചെയ്യപ്പെടുന്നു. ഈ ഭാഷാന്തരം ഉപയോഗിക്കുന്നതിൽ നിന്നുണ്ടാകുന്ന തെറ്റിദ്ധാരണകൾക്കും വ്യാഖ്യാനക്കുറവുകൾക്കും ഞങ്ങൾ ഉത്തരവാദിത്വം വഹിച്ചു നൽകുന്നില്ല.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,27 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "c9d207ff77b4bb46e46dc2b607a8ec1a",
"translation_date": "2026-01-08T10:13:29+00:00",
"source_file": "SUPPORT.md",
"language_code": "ml"
}
-->
# പിന്തുണ
## പ്രശ്നങ്ങൾ റിപ്പോർട്ട് ചെയ്ത് സഹായം എങ്ങനെ ലഭിക്കാമെന്നും
ഈ പ്രोजക്ട് ബഗുകളും ഫീച്ചർ അഭ്യർത്ഥനകളും ട്രാക്ക് ചെയ്യാൻ GitHub Issues ഉപയോഗിക്കുന്നു. പുനരാവൃത്തി ഒഴിവാക്കാൻ പുതിയ പ്രശ്നങ്ങൾ റിപ്പോർട്ട് ചെയ്യുന്നതിനു മുമ്പ് നിലവിലെ പ്രശ്നങ്ങൾ തിരയുക. പുതിയ പ്രശ്നങ്ങൾക്കായി നിങ്ങളുടെ ബഗ് അല്ലെങ്കിൽ ഫീച്ചർ അഭ്യർത്ഥന ഒരു പുതിയ Issue ആയി ഫയൽ ചെയ്യുക.
ഈ പ്രോജക്ട് ഉപയോഗിക്കുന്നതിന് സഹായവും ചോദ്യങ്ങൾക്കുമായി, [നമ്മുടെ സംഭാവന മാർഗ്ഗനിർദ്ദേശങ്ങൾ](CONTRIBUTING.md) കാണുക.
## മൈക്രോസോഫ്റ്റ് പിന്തുണ നയം
ഈ പ്രോജക്റ്റിന് പിന്തുണ മുകളിൽ വ്യക്തമാക്കിയ വിഭവങ്ങളിലേക്ക് മാത്രമാണ് പരിധിയിടുന്നത്.
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**വിചാരണാ കണക്കെടുപ്പ്**:
ഈ ഡോക്യുമെന്റ് എഐ വിവർത്തന സേവനം [Co-op Translator](https://github.com/Azure/co-op-translator) ഉപയോഗിച്ച് വിവർത്തനം ചെയ്‌തതാണ്. നമുക്ക് ശരിയായ വിവർത്തനം നൽകാനാണ് ശ്രമമെങ്കിലും, സ്വയം പ്രവർത്തിക്കുന്ന വിവർത്തനങ്ങളിൽ പിഴവുകള്‍ അല്ലെങ്കിൽ അസാധുവായ വിവരങ്ങൾ ഉണ്ടാകാനിടയുണ്ട് എന്ന് മനസിലാക്കിയിരിക്കണം. യഥാർത്ഥ ഡോക്യുമെന്റ് അതിന്റെ മാതൃഭാഷയിൽ ഏർപ്പെടുത്തിയിരിക്കുന്നത് പ്രാധാന്യമുള്ള ഉറവിടമായി കണക്കാക്കപ്പെടുക ഇതാണ്. നിർണായകമായ വിവരങ്ങൾക്ക് പ്രൊഫഷണൽ മനുഷ്യ വിവർത്തനം നിർദ്ദേശിക്കുന്നു. ഈ വിവർത്തനത്തിന്റെ ഉപയോഗത്തിൽ നിന്നുള്ള herhangi തെറ്റായ അവബോധം അല്ലെങ്കിൽ വ്യാഖ്യാനത്തിനുള്ള ഉത്തരവാദിത്തം ഞങ്ങൾ ഏറ്റെടുക്കുന്നില്ല.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,23 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "ea9f0804bd62f46d9808e953ec7fc459",
"translation_date": "2026-01-08T10:19:47+00:00",
"source_file": "_404.md",
"language_code": "ml"
}
-->
# പുരോഗമനത്തിലുള്ള പ്രവർത്തി
ഞങ്ങൾ ഈ പേജിൽ പ്രവർത്തിക്കുന്നു. ദയവായി പിന്നീട് തിരിച്ച് സന്ദർശിക്കുക.
നിങ്ങളുടെ ഏതെങ്കിലും സംശയങ്ങൾ ഉണ്ടെങ്കിൽ, ഒരു [issue](https://github.com/microsoft/Web-Dev-For-Beginners/issues/new/choose) തുറക്കുക.
**[Back home](../../../../../../..)**
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**ഉദ്യോഗസ്ഥ പ്രഖ്യാപനം**:
ഈ രേഖ [Co-op Translator](https://github.com/Azure/co-op-translator) എന്ന എഐ വിവർത്തന സേവനം ഉപയോഗിച്ച് വിവർത്തനം ചെയ്യപ്പെട്ടതാണ്. നാം കൃത്യതയ്ക്ക് ശ്രമിച്ചെങ്കിലും, സ്വയംഭരണ വിവർത്തനങ്ങളിൽ പിഴവുകളും അശുദ്ധികളുമുണ്ടാകാം എന്ന点 ദയവായി ശ്രദ്ധിക്കുക. ഒരു രേഖയുടെ പ്രാമാണിക വാശിയാകുന്നത് ആ ഭാഷയിലെ ആദ്യ രേഖ തന്നെയാണ്. നിർണായക വിവരങ്ങൾക്ക് പ്രൊഫഷണൽ മനുഷ്യ വിവർത്തനം ശുപാർശ ചെയ്യപ്പെടുന്നു. ഈ വിവർത്തനം ഉപയോഗിക്കുന്നതിലൂടെ ഉണ്ടാകുന്ന തെറ്റിദ്ധാരണകൾക്കും അർത്ഥവ്യത്യാസങ്ങൾക്കും ഞങ്ങൾ ഉത്തരവാദികളല്ല.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,36 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "3bd2f51ecf4ac9b39277cba748943793",
"translation_date": "2026-01-08T11:39:21+00:00",
"source_file": "docs/_navbar.md",
"language_code": "ml"
}
-->
- Translations
- [English (United States)](../../../docs/README)
- [বাংলা](../../../docs/README.bn)
- [中文(中国)](../../../docs/README.zh-cn)
- [中文(台湾)](../../../docs/README.zh-tw)
- [Español](../../../docs/README.es)
- [Français](../../../docs/README.fr)
- [Ελληνικά](../../../docs/README.el)
- [हिन्दी](../../../docs/README.hi)
- [Bahasa Melayu](../../../docs/README.ms)
- [മലയാളം](../../../docs/README.ml)
- [தமிழ്](../../../docs/README.ta)
- [తెలుగు](../../../docs/README.te)
- [Bahasa Indonesia](../../../docs/README.id)
- [Italiano](../../../docs/README.it)
- [日本語](../../../docs/README.ja)
- [Nederlands](../../../docs/README.nl)
- [नेपाली](../../../docs/README.np)
- [Português](../../../docs/README.pt)
- [Русский](../../../docs/README.ru)
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**വ്യക്തിഗത ഉത്തരവാദിത്തം**:
ഈ പ്രമാണം AI തർജുമാ സേവനമായ [Co-op Translator](https://github.com/Azure/co-op-translator) ഉപയോഗിച്ച് തർജുമചെയ്തതാണ്. നാം ശുദ്ധതയ്ക്ക് ശ്രമിക്കുന്നുവെങ്കിലും, ഓട്ടോമാറ്റഡ് തർജുമകളിൽ പിഴവുകൾ അല്ലെങ്കിൽ അസാധുതകൾ ഉണ്ടാകാമെന്ന് ദയവായി ശ്രദ്ധിക്കുക. അതിനാൽ, പ്രമാണത്തിന്റെ അതിന്റേതായ ഭാഷയിലുള്ള മൊഴി തന്നെ പ്രാമാണികമായ ഉറവിടമായി പരിഗണിക്കmalıdır. നിർണ്ണായക വിവരങ്ങൾക്ക്, പ്രൊഫഷണൽ മാനവ തർജുമ പരിശോധിക്കുക എന്നതാണ് ശുപാർശ. ഈ തർജുമ ഉപയോഗിച്ചതിന്റെ ഫലമായി ഉണ്ടാകുന്ന ഏതെങ്കിലും തെറ്റിദ്ധാരണകൾക്ക് ഞങ്ങൾ ഉത്തരവാദിത്തം വെക്കുകയില്ല.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,53 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "655c91b5979de46f1d70d97f0c5f1d14",
"translation_date": "2026-01-08T11:38:09+00:00",
"source_file": "docs/_sidebar.md",
"language_code": "ml"
}
-->
- വെളിപ്പെടുത്തല്‍
- [1](../1-getting-started-lessons/1-intro-to-programming-languages/README.md)
- [2](../1-getting-started-lessons/2-github-basics/README.md)
- [3](../1-getting-started-lessons/3-accessibility/README.md)
- JS അടിസ്ഥാനങ്ങള്‍
- [4](../2-js-basics/1-data-types/README.md)
- [5](../2-js-basics/2-functions-methods/README.md)
- [6](../2-js-basics/3-making-decisions/README.md)
- [7](../2-js-basics/4-arrays-loops/README.md)
- HTML, CSS, JS
- [8](../3-terrarium/1-intro-to-html/README.md)
- [9](../3-terrarium/2-intro-to-css/README.md)
- [10](../3-terrarium/3-intro-to-DOM-and-closures/README.md)
- టైപ്പിംഗ് ഗെയിം
- [11](../4-typing-game/typing-game/README.md)
- ബ്രൗസര്‍ എക്‌സ്റ്റെന്‍ഷന്‍
- [12](../5-browser-extension/1-about-browsers/README.md)
- [13](../5-browser-extension/2-forms-browsers-local-storage/README.md)
- [14](../5-browser-extension/3-background-tasks-and-performance/README.md)
- സ്പേസ് ഗെയിം
- [15](../6-space-game/1-introduction/README.md)
- [16](../6-space-game/2-drawing-to-canvas/README.md)
- [17](../6-space-game/3-moving-elements-around/README.md)
- [18](../6-space-game/4-collision-detection/README.md)
- [19](../6-space-game/5-keeping-score/README.md)
- [20](../6-space-game/6-end-condition/README.md)
- ബാങ്ക് പ്രോജക്ട്
- [21](../7-bank-project/1-template-route/README.md)
- [22](../7-bank-project/2-forms/README.md)
- [23](../7-bank-project/3-data/README.md)
- [24](../7-bank-project/4-state-management/README.md)
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**പരാമർശം**:
ഈ ഡോക്യുമെന്റ് എഐ വിവർത്തന സേവനം [Co-op Translator](https://github.com/Azure/co-op-translator) ഉപയോഗിച്ച് വിവർത്തനം ചെയ്‌തതാണ്. നാം കൃത്യതക്ക് പരിശ്രമിക്കുന്നുവെങ്കിലും, സ്വയം പ്രവർത്തിക്കുന്ന വിവർത്തനങ്ങളിൽ പിശകുകൾ അല്ലെങ്കിൽ തപ്പുകൾ ഉണ്ടാകാവുന്നതാണ്. പ്രാഥമികമായ അസൽ ഡോക്യുമെന്റ് അതിന്റെ മാതൃഭാഷയിൽ പ്രാമാണിക സ്രോതസ്സ് ആയി പരിഗണിക്കേണ്ടതാണ്. നിർണായകമായ വിവരങ്ങൾക്ക് പ്രൊഫഷണൽ മനുഷ്യവിവർത്തനം ശിപാർശ ചെയ്യപ്പെടുന്നു. ഈ വിവർത്തനം ഉപയോഗിച്ചുള്ള ഏതെങ്കിലും തെറ്റു മനസ്സിലാക്കലുകൾക്കോ വ്യാഖ്യാനക്കേടുകൾക്കോ ഞങ്ങൾ ഉത്തരവാദികളല്ല.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,80 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "71009af209f81cc01a1f2d324200375f",
"translation_date": "2026-01-08T10:11:39+00:00",
"source_file": "for-teachers.md",
"language_code": "ml"
}
-->
### അധ്യാപകര്‍ക്ക്
ഈ പാഠ്യക്രമം നിങ്ങളുടെ ക്ലാസ്സുകളില്‍ ഉപയോഗിക്കുന്നതിന് സ്വാഗതം. ഇത് GitHub Classroom-നും മുഖ്യ LMS പ്ലാറ്റ്ഫോറങ്ങളില്‍ കൂടി ദ്രുതഗതിയിലും എളുപ്പത്തിൽ പ്രവര്‍ത്തിക്കുന്നു, കൂടാതെ ഇത് നിങ്ങളുടെ വിദ്യാര്‍ത്ഥികളോടൊപ്പം സ്വതന്ത്ര റിപ്പോസിറ്ററിയായി ഉപയോഗിക്കാം.
### GitHub Classroom-ന്‍റെൊപ്പം ഉപയോഗിക്കുക
പ്രതിവ6371, ക്ലാസ്‍കര്‍ക്രമം, അഭ്യാസങ്ങള്‍ പൊതുസഞ്ചിതമായിരിക്കുന്നു ആദ64-യുള്ളവര്‍ക്കും വേണ്ടിയാണ് GitHub Classroom ഉപയോഗിക്കുന്നത്.
- ഈ റിപ്പൊ നിങ്ങളുടെ ഓര്‍ഗനൈസേഷനിലേക്കു ഫോര്‍ക്ക് ചെയ്യുക.
- ഓരോ പാഠത്തിനും പ്രത്യേക റിപ്പൊ സൃഷ്ടിക്കുക, അതിലൂടെ GitHub Classroom ഓരോ അഭ്യാസവും സ്വതന്ത്രമായി ചേര്‍ക്കാന്‍ കഴിയുന്നു.
- ഓപ്ഷന്‍ A: വായ്പ്പു റിപ്പൊകള്‍ (ഓരോ പാഠത്തിനും ഒരൊറ്റ), അവയില്‍ പാഠഫോള്ഡര്‍ ഉള്ളടക്കം പകർത്തുക.
- ഓപ്ഷന്‍ B: ചരിത്രം സംരക്ഷിക്കുന്ന രീതിയില്‍ (ഉദാഹരണത്തിന് ഒരു ഫോള്‍ഡര്‍ പുതിയ റിപ്പൊയിലേക്കു വിഭജിക്കുക) ചെയ്തുകൊണ്ടു സൃഷ്ടിക്കുക.
- GitHub Classroom-ല്‍ ഓരോ പാഠത്തിന് ഒരു അഭ്യാസം സൃഷ്ടിച്ച് അനുയോജ്യമായ പാഠ റിപ്പൊയിലേക്ക് സൂചിപ്പിക്കുക.
- ശുപാര്‍ശ ചെയ്യുന്ന ക്രമീകരണങ്ങള്‍:
- റിപ്പൊവിസിബിലിറ്റി: വിദ്യാര്‍ത്ഥി പ്രവര്‍ത്തനത്തിനായി സ്വകാര്യമായി വെക്കുക.
- പാഠം റിപ്പൊയുടെ ഡിഫോൾട്ട് ബ്രാഞ്ചില്‍ നിന്ന് തുടങ്ങിയ കോഡ് ഉപയോഗിക്കുക.
- ക്വിസുകളും സമര്‍പ്പണങ്ങളും വേണ്ടി ഇഷൂയുടെയും പുള്ള് റിക്ക്വസ്റ്റ് ടെംപ്ലേറ്റുകള്‍ ചേര്‍ക്കുക.
- നിങ്ങളുടെ പാഠങ്ങളില്‍ ഓട്ടോഗ്രേഡിംഗ്, ടെസ്റ്റുകൾ ഉൾപ്പെട്ടിട്ടുണ്ടെങ്കില്‍ അവ ക്രമീകരിക്കുക.
- സഹായകമായ സന്ധര്‍ഭങ്ങള്‍:
- റിപ്പൊ പേരുകള്‍ lesson-01-intro, lesson-02-html തുടങ്ങിയവ പോലെ.
- ലേബലുകള്‍: quiz, assignment, needs-review, late, resubmission.
- ഓരോ കോഹോര്‍ട്ടിന് ടാഗുകള്‍/റിലീസുകള്‍ (ഉദാ. v2025-term1).
ടിപ്പ്: വിന്‍ഡോസ് Git konflikts ഒഴിവാക്കാന്‍, സെങ്ക്ലഡായ ഫോള്‍ഡറുകള്‍ (OneDrive/Google Drive പോലുള്ള) ഉള്ളില്‍ റിപ്പോസിടറികള്‍ സൂക്ഷിക്കുന്നത് ഒഴിവാക്കുക.
### Moodle, Canvas, അല്ലെങ്കില്‍ Blackboard-നൊപ്പം ഉപയോഗിക്കുക
ഈ പാഠ്യക്രമം സാധാരണ LMS പ്രവൃത്തിക്കും അനുയോജ്യമായ ഇറക്കുമതി പാക്കേജുകൾ ഉൾപ്പെടുന്നു.
- Moodle: പാഠ്യക്രമം മുഴുവനും ലോഡ് ചെയ്യാൻ Moodle അപ്ലോഡ് ഫയല്‍ [Moodle upload file](../../../../../../../teaching-files/webdev-moodle.mbz) ഉപയോഗിക്കുക.
- Common Cartridge: വ്യാപകമായ LMS യുമായി പൊരുത്തപ്പെടാന്‍ Common Cartridge ഫയല്‍ [Common Cartridge file](../../../../../../../teaching-files/webdev-common-cartridge.imscc) ഉപയോഗിക്കുക.
- കുറിപ്പുകൾ:
- Moodle Cloudയ്ക്ക് Common Cartridge പിന്തുണ കുറവാണ്. മുകളില്‍ പറയുന്ന Moodle ഫയല്‍ ഉപയോഗിക്കുക, അത് Canvas-ലും അപ്ലോഡ് ചെയ്യാം.
- ഇറക്കുമതി ചെയ്ത ശേഷം, നിങ്ങളുടെ ടേം ഷെഡ്യൂളിന് അനുയോജ്യമായി മോഡ്യൂളുകളും, തീയ്യതികളും, ക്വിസുകളുടെ ക്രമീകരണങ്ങളും പരിശോധിക്കുക.
![Moodle](../../translated_images/moodle.94eb93d714a50cb2.ml.png)
> Moodle ക്ലാസ്സില്‍ പാഠ്യക്രമം
![Canvas](../../translated_images/canvas.fbd605ff8e5b8aff.ml.png)
> Canvas-ൽ പാഠ്യക്രമം
### ക്ലാസ്സ്‌റൂം ഇല്ലാതെ ഈ റിപ്പോ നേരിട്ട് ഉപയോഗിക്കുക
GitHub Classroom ഉപയോഗിക്കാതെ നേരിട്ട് ഈ റിപ്പോയില്‍ നിന്നു കോഴ്സ് പ്രവര്‍ത്തിപ്പിക്കാം.
- സിങ്ക്‌റോണസ്/ഓണ്‍ലൈനായി (Zoom/Teams):
- ചോദ്യത്തിന്‍റെ ഉത്തരം സессണുകള്‍ നടത്തുക; ക്വിസുകൾക്ക് ബ്രേക്ക് ഔട്ട് റൂമുകൾ ഉപയോഗിക്കുക.
- ക്വിസുകള്‍ക്കായി സമയപരിധി പ്രഖ്യാപിക്കുക; വിദ്യാര്‍ത്ഥികള്‍ ഉത്തരങ്ങള്‍ GitHub Issues ആയി സമര്‍പ്പിക്കും.
- കൂട്ടായി ചെയ്യുന്ന അഭ്യാസങ്ങള്‍ക്കായി, വിദ്യാര്‍ത്ഥികള്‍ പൊതുവായ പാഠം റിപ്പോസിറ്ററികളില്‍ പ്രവര്‍ത്തിച്ച് പുള്ള് റിക്ക്വസ്റ്റുകള്‍ തുറക്കും.
- പ്രൈവറ്റ്/അസിങ്ക്‌റോണസ് ഫോർമാറ്റുകള്‍:
- ഓരോ പാഠവും കടന്നുവാങ്ങി നിങ്ങളുടെ സ്വത്തമായ **സ്വകാര്യ** റിപ്പോസിറ്ററികളാക്കി, നിങ്ങളെ സഹപ്രവര്‍ത്തകനായി ചേര്‍ക്കുക.
- ക്ലാസ്‌പഠന റിപ്പო അല്ലെങ്കില്‍ സ്വന്തം സ്വകാര്യ ഫോര്‍ക്കുകളില്‍ Issues (ക്വിസുകള്‍)നും Pull Requests (അഭ്യാസങ്ങള്‍)നും വഴി സമര്‍പ്പിക്കുക.
### മികച്ച പ്രാക്ടിസുകള്‍
- Git/GitHub അടിസ്ഥാനങ്ങള്‍, Issues, PRs എന്നിവയെ കുറിച്ച് ഒരു ഓറിയന്റേഷന്‍ പാഠം നല്‍കുക.
- Issues-ല്‍ ബഹു-ചുവട് ചോദ്യങ്ങള്‍ക്ക്/അഭ്യാസങ്ങള്‍ക്ക് ചെക്‌ലിസ്റ്റ് ഉപയോഗിക്കുക.
- CONTRIBUTING.md, CODE_OF_CONDUCT.md അടക്കം ക്ലാസ്‌റൂം നയങ്ങള്‍ നിശ്ചയിക്കുക.
- ആക്‌സസിബിലിറ്റിയുടെ കുറിപ്പുകളും (alt പാഠം, ക്യാപ്ഷനുകൾ) പ്രിന്റ് ചെയ്യാവുന്ന PDF-കളും ചേര്‍ക്കുക.
- പാഠ്യവിഷയങ്ങള്‍ വര്‍ഷത്തിലോ സെമസ്റ്ററിലോ ഒപ്പം വേഴ്ഷന്‍ ചെയ്യുക, പ്രസിദ്ധീകരണത്തിനു ശേഷം പാഠം റിപ്പോസിറ്ററികള്‍ പൂട്ടുക.
### പ്രതികരണങ്ങളും പിന്തുണയും
ഈ പാഠ്യക്രമം നിങ്ങളും നിങ്ങളുടെ വിദ്യാര്‍ത്ഥികളും ഉപയോഗിക്കാനായി ആഗ്രഹിക്കുന്നു. പിഴവുകള്‍, ആവശ്യങ്ങള്‍, മെച്ചപ്പെടുത്തലുകള്‍ക്കായി ഈ റിപ്പോഷിറ്ററിയില്‍ പുതിയ ഒരു Issue തുറക്കുക, അല്ലെങ്കില്‍ Teacher Corner-ല്‍ ചര്‍ച്ച ആരംഭിക്കുക.
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**തൊഴിലാളി**:
ഈ രേഖ AI തർജ്ജമാ സേവനം [കോ-ഓപ് ട്രാൻസ്‌ലേറ്റർ](https://github.com/Azure/co-op-translator) ഉപയോഗിച്ച് തർജ്ജമ ചെയ്തു. നാം നിർവേദനക്ഷമതയ്ക്കായി ശ്രമിച്ചിട്ടും, സ്വയംഭരണ തർജ്ജമകൾ പിശകുകൾ അല്ലെങ്കിൽ തെറ്റായ വിവരങ്ങൾ ഉൾപ്പെടുത്താവുന്നത് ശ്രദ്ധിക്കുക. എല്ലാ പ്രധാന വിവരങ്ങൾക്കും സ്വദേശഭാഷയിൽ ഉള്ള മൗലിക രേഖയെ വിശ്വസനീയമായ ഉറവിടമായി കാണണം. നിർണായക വിവരങ്ങൾക്ക് പ്രൊഫഷണൽ മനുഷ്യ തർജ്ജമ ശുപാർശ ചെയ്യപ്പെടുന്നു. ഈ തർജ്ജമ ഉപയോഗിച്ച് ഉണ്ടാകുന്ന സംശയങ്ങൾക്കും തെറ്റായ വിവർത്തനങ്ങൾക്കും ഞങ്ങൾ ഉത്തരവാദികളല്ല.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,67 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "0494be70ad7fadd13a8c3d549c23e355",
"translation_date": "2026-01-08T11:41:28+00:00",
"source_file": "lesson-template/README.md",
"language_code": "ml"
}
-->
# [പാഠ വിഷയം]
![ഇവിടെ ഒരു വീഡിയോ എംബെഡ് ചെയ്യുക](../../../lesson-template/video-url)
## [പാഠത്തിന് മുമ്പുള്ള ക്വിസ്](../../../lesson-template/quiz-url)
[നാം പഠിക്കാനുള്ളത് വിവരിക്കുക]
### പരിചയം
എന്തെന്താം വിഷയങ്ങൾ ഉൾപ്പെടുമെന്ന് വിവരിക്കുക
> കുറിപ്പുകൾ
### മുൻഷരതുകൾ
ഈ പാഠത്തിനു മുമ്പായി ഏതെല്ലാം നടപടി ക്രമങ്ങൾ പൂർത്തിയാക്കണമായിരിക്കും?
### തയ്യാറെടുപ്പ്
ഈ പാഠം ആരംഭിക്കാൻ വേണ്ട തയ്യാറെടുപ്പ് നടപടികൾ
---
[തടങ്ങളായി ഉള്ളടക്കം പരിശോധിക്കുക]
## [വിഷയം 1]
### താസ്‌ക്:
പങ്കിടപ്പെട്ട കോഡോടുകൂടി പ്രോജക്ട് നിർമ്മിക്കാൻ നിങ്ങളുടെ കോഡ്ബെയ്സ് ക്രമം ക്രമമായി മെച്ചപ്പെടുത്താൻ ഒത്തു ചേരുക:
```html
code blocks
```
✅ അറിവ് പരിശോധന - തുറന്ന ചോദ്യംകൾ ഉപയോഗിച്ച് വിദ്യാർത്ഥികളുടെ അറിവ് വ്യാപിപ്പിക്കാൻ ഈ അവസരം ഉപയോഗിക്കൂ
## [വിഷയം 2]
## [വിഷയം 3]
🚀 വെല്ലുവിളി: ക്ലാസിൽ സഹകരിച്ച് പ്രോജക്ട് മെച്ചപ്പെടുത്താൻ വിദ്യാർത്ഥികൾക്ക് വെല്ലുവിളി ചേർക്കുക
ഓപ്ഷണൽ: പൂർത്തിയായ പാഠത്തിന്റെ UI-യുടെ സ്ക്രീൻഷോട്ട് ആവശ്യമായെങ്കിൽ ചേർക്കുക
## [പഠനത്തിന് ശേഷമുള്ള ക്വിസ്](../../../lesson-template/quiz-url)
## അവലോകനം & സ്വയം പഠനം
**അസൈൻമെന്റ് സമർപ്പണ നിശ്ചിത തിയ്യതി [MM/YY]**: [അസൈൻമെന്റ് പേര്](assignment.md)
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**അസാധുവാക്കൽ**:
ഈ രേഖ AI പരിഭാഷ സേവനം [Co-op Translator](https://github.com/Azure/co-op-translator) ഉപയോഗിച്ച് പരിഭാഷ ചെയ്തതാണ്. ഞങ്ങൾ കൃത്യതയ്ക്ക് ശ്രമിച്ചാലും, യന്ത്രപരിഭാഷയിൽ പിഴവുകൾ അല്ലെങ്കിൽ അകുറ്റ സമയങ്ങൾ ഉണ്ടാകാമെന്ന് ശ്രദ്ധിക്കുക. യഥാർത്ഥ രേഖ അവരുടെ സ്വദേശഭാഷയിൽ ഉള്ളത് അവധാരിത ഉറവിടമായി കണക്കാക്കേണ്ടതാണ്. സുപ്രധാന വിവരങ്ങൾക്ക് പ്രൊഫഷണൽ മനുഷ്യ പരിഭാഷ ശുപാർശ ചെയ്യുന്നു. ഈ പരിഭാഷ ഉപയോഗത്തിൽ ഉണ്ടായ misunderstandings അല്ലെങ്കിൽ തെറ്റിദ്ധാരണകൾക്കെതിരെ ഞങ്ങൾ ഉത്തരവാദിത്തം ഏറ്റെടുക്കില്ല.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,25 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "b5f62ec256c7e43e771f0d3b4e1a9130",
"translation_date": "2026-01-08T11:42:25+00:00",
"source_file": "lesson-template/assignment.md",
"language_code": "ml"
}
-->
# [അസൈന്‍മെന്റ് പേര്]
## നിർദ്ദേശങ്ങൾ
## റൂബ്രിക്ക്
| മാനദണ്ഡം | ഉദാത്തമായത് | ശരിയായി | മെച്ചപ്പെടുത്തേണ്ടത് |
| -------- | --------- | -------- | ----------------- |
| | | | |
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**തൽക്കാലിക സഹിതം**:
ഈ രേഖ AI വിവർത്തന സേവനം [Co-op Translator](https://github.com/Azure/co-op-translator) ഉപയോഗിച്ച് വിവർത്തനം ചെയ്തതാണ്. നാം കൃത്യതയ്‌ക്ക് ശ്രമിച്ചുള്ളതെങ്കിലും, യന്ത്രം നിർവഹിക്കുന്ന വിവർത്തനങ്ങളിൽ പിശകുകൾ അല്ലെങ്കിൽ അശുദ്ധികൾ ഉണ്ടാകാവുന്നതാണ്. മൂല രേഖ അതിന്റെ കൊടുത്ത ഭാഷയിൽ തന്നേ വിശ്വസനീയമായ ഉറവിടമായി കണക്കാക്കണം. നിർണ്ണായക വിവരങ്ങൾക്ക്, വിദഗ്ധ മനുഷ്യ വിവർത്തനം ശുപാർശ ചെയ്യുന്നു. ഈ വിവർത്തനത്തെ അടിസ്ഥാനമാക്കി ഉണ്ടായ任何 தவറുകളും അർത്ഥ വ്യത്യാസങ്ങൾക്കുമുള്ള ഉത്തരവാദിത്തം ഞങ്ങൾ ഏറ്റെടുക്കുന്നില്ല.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,52 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "ff47271e53637b2ba6ba72ad2b70f6d7",
"translation_date": "2026-01-08T11:29:11+00:00",
"source_file": "memory-game/README.md",
"language_code": "ml"
}
-->
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
## Getting Started
ആദ്യം, ഡെവലപ്പ്മെന്റ് സെർവർ പ്രവർത്തിപ്പിക്കുക:
```bash
npm run dev
# അല്ലെങ്കിൽ
yarn dev
# അല്ലെങ്കിൽ
pnpm dev
# അല്ലെങ്കിൽ
bun dev
```
ഫലമായി കാണാൻ നിങ്ങളുടെ ബ്രൗസറിൽ [http://localhost:3000](http://localhost:3000) തുറക്കുക.
`app/page.js` ഫയൽ മാറ്റം വരുത്തി പേജ് എഡിറ്റിംഗ് ആരംഭിക്കാം. ഫയൽ എഡിറ്റ് ചെയ്യുമ്പോളുതന്നെ പേജ് സ്വയമേവ അപ്‌ഡേറ്റ് ചെയ്യും.
ഈ പ്രോജക്റ്റ് [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) ഉപയോഗിച്ച് ഓട്ടോമാറ്റിക്കായാണ് ലോഡ് ചെയ്യപ്പെടുന്നതും ഒപ്റ്റിമൈസ് ചെയ്തെടുത്തിരിക്കുന്നതും [Geist](https://vercel.com/font), Vercel പ്രതിഷ്ഠിച്ച പുതിയ ഫോണ്ട് കുടുംബം.
## Learn More
Next.js എക്കുറിച്ച് കൂടുതൽ അറിയാൻ താഴെ കൊടുത്തിരിക്കുന്ന സ്രോതസ്സുകൾ നോക്കുക:
- [Next.js Documentation](https://nextjs.org/docs) - Next.js ഫീച്ചറുകളെയും API-യേയും കുറിച്ച് അറിയുക.
- [Learn Next.js](https://nextjs.org/learn) - ഇന്ററാക്ടീവ് Next.js പരിശീലനം.
നിങ്ങൾക്ക് [Next.js GitHub റീപോസിറ്ററി](https://github.com/vercel/next.js) സന്ദർശിക്കാം — നിങ്ങളുടെ ഫീഡ്‌ബാക്കും സംഭാവനകളും സ്വാഗതം ചെയ്യുന്നു!
## Deploy on Vercel
നിങ്ങളുടെ Next.js ആപ്പ് ഡെപ്ലോയ് ചെയ്യാനുള്ള ഏറ്റവും എളുപ്പമാർഗം Next.js സൃഷ്ടിച്ച [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) ഉപയോഗിച്ചാണ്.
കൂടുതൽ വിവരങ്ങൾക്ക് നമ്മുടെ [Next.js deployment документация](https://nextjs.org/docs/app/building-your-application/deploying) പരിശോധിക്കുക.
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**അസൂയാപേരിപ്പ്**:
ഈ ഡോക്യുമെന്റ് AI വിവർത്തന സേവനം [Co-op Translator](https://github.com/Azure/co-op-translator) ഉപയോഗിച്ച് വിവർത്തനം ചെയ്തതാണ്. നാം ശരിയായ വിവർത്തനത്തിന് ശ്രമിച്ചെങ്കിലും, സ്വയംകൃതമായി നടത്തിയ വിവർത്തനങ്ങളിൽ പിശകുകൾ അല്ലെങ്കിൽ തത്വഭ്രഷ്ടതകൾ ഉണ്ടാകാനുള്ള സാധ്യതയുണ്ട്. അതിനാൽ, യഥാർത്ഥ ഡോക്യുമെന്റ് അതിന്റെ মাতൃഭാഷയിലുള്ള പ്രാമാണിക സ്രോതസ്സായി കണക്കാക്കേണ്ടതാണ്. പ്രധാനപ്പെട്ട വിവരങ്ങൾക്ക്, പ്രൊഫഷണൽ മാനവ വിവർത്തനം നിർദ്ദേശിക്കപ്പെടുന്നു. ഈ വിവർത്തനം ഉപയോഗിച്ചതിൽ നിന്നുണ്ടാകുന്ന അവ മനസ്സിലാക്കൽ തർക്കങ്ങൾക്കോ തെറ്റിദ്ധാരണകൾക്കോ ഞങ്ങൾ ഉത്തരവാദികളല്ല.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,193 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "5301875c55bb305e6046bed3a4fd06d2",
"translation_date": "2026-01-08T11:16:42+00:00",
"source_file": "quiz-app/README.md",
"language_code": "ml"
}
-->
# ക്വിസ് ആപ്പ്
ഈ ക്വിസുകൾ https://aka.ms/webdev-beginners ൽ ഉള്ള ഡേറ്റാ സയൻസ് പാഠ്യപദ്ധതിയുടേതായി ലെക്ചർക്കു മുമ്പും ശേഷം നടത്തപ്പെടുന്ന ക്വിസുകളാണ്
## ഭാഷಾಂತರിച്ച ക്വിസ് സെറ്റ് ചേർക്കൽ
`assets/translations` ഫോൾഡറുകളിൽ പൊരുത്തമുള്ള ക്വിസ് ഘടനകൾ സൃഷ്ടിച്ച് ഒരു ക്വിസ് പരിഭാഷ ചേർക്കുക. മുൻനിര്‍ദേശിച്ച ക്വിസുകൾ `assets/translations/en` ൽ ഉണ്ട്. ക്വിസുകള്‍ നിരവധി ഗ്രൂപ്പുകളായി വിഭജിച്ചിരിക്കുന്നു. ക്വിസ് വിഭാഗങ്ങളുടെ നമ്പറിങ്ങുമായി ശരിയായി പൊരുത്തപ്പെടുന്നുണ്ടോയെന്ന് ഉറപ്പാക്കുക. ഈ പാഠ്യപദ്ധതിയിൽ 40 ക്വിസുകളുണ്ട്, എണ്ണം 0 മുതൽ ആരംഭിക്കുന്നു.
<details>
<summary>ഇവിടെ ഒരു പരിഭാഷ ഫയലിന്റെ രൂപം ഇപ്രകാരം:</summary>
```
[
{
"title": "A title",
"complete": "A complete button title",
"error": "An error message upon selecting the wrong answer",
"quizzes": [
{
"id": 1,
"title": "Title",
"quiz": [
{
"questionText": "The question asked",
"answerOptions": [
{
"answerText": "Option 1 title",
"isCorrect": true
},
{
"answerText": "Option 2 title",
"isCorrect": false
}
]
}
]
}
]
}
]
```
</details>
പരിഭാഷകൾ എഡിറ്റ് ചെയ്തശേഷം, `en`ൽ ഉള്ള സൂചനകൾ പാലിച്ച് എല്ലാ ഫയലുകളും ഇൻഡക്സ്.js ഫയലിൽ ഇറക്കുമതി ചെയ്യുക.
പുതിയ പരിഭാഷാ ഫയലുകൾ ഇറക്കുമതി ചെയ്യുന്നതിന് `assets/translations` എന്നുള്ള ഡയറക്ടറിയിലെ `index.js` ഫയൽ എഡിറ്റ് ചെയ്യുക.
ഉദാഹരണത്തിന്, നിങ്ങൾ പരിഭാഷ സി‌ JSON ഫയലായ `ex.json` ൽ ഉണ്ടെങ്കിൽ, അതിന്റെ ലൊക്കലൈസേഷൻ കീ ആയി 'ex' നൽകുകയും താഴെ കാണുന്നതുപോലെ ഇറക്കുമതി ചെയ്യുക
<details>
<summary>index.js</summary>
```
import ex from "./ex.json";
// if 'ex' is localization key then enter it like so in `messages` to expose it
const messages = {
ex: ex[0],
};
export default messages;
```
</details>
## ക്വിസ് ആപ്പ് ലോക്കലായി പ്രവർത്തിപ്പിക്കൽ
### മുൻ‌റിയിപ്പുകൾ
- ഒരു GitHub അക്കൗണ്ട്
- [Node.js and Git](https://nodejs.org/)
### ഇൻസ്റ്റാൾ & സെറ്റപ്പ്
1. ഈ [ടെംപ്ലേറ്റ്](https://github.com/new?template_name=Web-Dev-For-Beginners&template_owner=microsoft) ഉപയോഗിച്ച് ഒരു റെപ്പോസിറ്ററി സൃഷ്ടിക്കുക
1. പുതിയ റെപ്പോസിറ്ററി ക്ലോൺ ചെയ്ത് quiz-app ലേക്ക് പോവുക
```bash
git clone https://github.com/your-github-organization/repo-name
cd repo-name/quiz-app
```
1. npm പാക്കേജുകളും ഡിപ്പെൻഡൻസികളും ഇൻസ്റ്റാൾ ചെയ്യുക
```bash
npm install
```
### ആപ്പ് ബിൽഡ് ചെയ്യുക
1. സൊല്യൂഷൻ ബിൽഡ് ചെയ്യാൻ, ഇതു റൺ ചെയ്യുക:
```bash
npm run build
```
### ആപ്പ് സ്റ്റാർട്ട് ചെയ്യുക
1. സൊല്യൂഷൻ റൺ ചെയ്യാൻ, ഇതു റൺ ചെയ്യുക:
```bash
npm run dev
```
### [ഐച്ഛികം] ലിന്റിംഗ്
1. കോഡ് ലിന്റ് ചെയ്യപ്പെട്ടിട്ടുണ്ടെന്ന് ഉറപ്പാക്കാൻ, ഇതു റൺ ചെയ്യുക:
```bash
npm run lint
```
## ക്വിസ് ആപ്പ് Azure ൽ ഡിപ്ലോയ് ചെയ്യുക
### മുൻ‌റിയിപ്പുകൾ
- ഒരു Azure സബ്സ്ക്രിപ്ഷൻ. സൗജന്യമായി ഒന്ന് റജിസ്റ്റർ ചെയ്യാൻ [ഇവിടെ](https://aka.ms/azure-free) ചെയ്യുക.
_ഈ ക്വിസ് ആപ്പ് ഡിപ്ലോയ് ചെയ്യാനുള്ള ചെലവ്: സൗജന്യ_
[![Deploy to Azure](https://aka.ms/deploytoazurebutton)](https://portal.azure.com/#create/Microsoft.StaticApp)
മുകളിലുള്ള ലിങ്കിൽ അതിലൂടെ Azureയിൽ സൈൻ ഇൻ ചെയ്തതിനു ശേഷം, ഒരു സബ്സ്ക്രിപ്ഷനും റിസോഴ്‌സ് ഗ്രൂപ്പും തിരഞ്ഞെടുത്ത്:
- സ്റ്റാറ്റിക് വെബ് ആപ്പ് വിശദാംശങ്ങൾ: ഒരു പേര് നൽകുക, ഹോസ്റ്റിങ് പ്ലാൻ തിരഞ്ഞെടുക്കുക
- GitHub ലോഗിൻ: ഡിപ്പ്ലോയ്‌മെന്റിന്റെ ഉറവിടമായി GitHub തിരഞ്ഞെടുക്കുക, പിന്നീട് ലോഗിൻ ചെയ്ത് ഫോമിലെ ആവശ്യമായ ഫീൽഡുകൾ പൂരിപ്പിക്കുക:
- *ഓർഗനൈസേഷൻ* നിങ്ങളുടെ ഓർഗനൈസേഷൻ തിരഞ്ഞെടുക്കുക.
- *റിപ്പോസിറ്ററി* Web Dev for Beginners പാഠ്യപദ്ധതി റെപ്പോസിറ്ററി തിരഞ്ഞെടുക്കുക.
- *ബ്രാഞ്ച്* - ഒരു ബ്രാഞ്ച് (main) തിരഞ്ഞെടുക്കുക
- ബിൽഡ് പ്രിസെറ്റ്സ്: Azure സ്റ്റാറ്റിക് വെബ് ആപ്പുകൾ നിങ്ങളുടെ ആപ്പിൽ ഉപയോഗിക്കുന്ന ഫ്രെയിമ്വർക്കിനെ കണ്ടെത്താൻ ഒരു കണ്ടെത്തൽ ആൾഗോരിതം ഉപയോഗിക്കുന്നു.
- *ആപ്പ് ലൊക്കേഷൻ* - ./quiz-app
- *API ലൊക്കേഷൻ* -
- *ഔട്ട്പുട്ട് ലൊക്കേഷൻ* - dist
- ഡിപ്ലോയ്‌മെന്റ്: 'Review + Create' ക്ലിക്ക് ചെയ്യുക, ശേഷം 'Create' ക്ലിക്ക് ചെയ്യുക
ഡിപ്ലോയ്മെന്റ് കഴിഞ്ഞതോടെ നിങ്ങളുടെ റെപ്പോസിറ്ററിയുടെ *.github* ഡയറക്ടറിയിൽ ഒരു വർക്ക്‌ഫ്ലോ ഫയൽ സൃഷ്ടിക്കും. ആ വർക്ക്‌ഫ്ലോ ഫയലിൽ ആപ്പിനെ Azure-ൽ വീണ്ടും ഡിപ്ലോയ്മെന്റ് നടത്തുന്നതിനുള്ള ട്രിഗർ സംഭവങ്ങളുടെ നിർദ്ദേശങ്ങൾ ഉണ്ടാകും, ഉദാഹരണം ആയി _**main** ബ്രാഞ്ചിൽ **push**_ തുടങ്ങിയവ.
<details>
<summary>ഉദാഹരണ വർക്ക്‌ഫ്ലോ ഫയൽ</summary>
GitHub Actions വർക്ക്‌ഫ്ലോ ഫയൽ എങ്ങനെ കാണിക്കാം എന്ന ഒരു ഉദാഹരണം ഇതാ:
name: Azure Static Web Apps CI/CD
```
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- main
jobs:
build_and_deploy_job:
runs-on: ubuntu-latest
name: Build and Deploy Job
steps:
- uses: actions/checkout@v2
- name: Build And Deploy
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
action: "upload"
app_location: "quiz-app" # App source code path
api_location: ""API source code path optional
output_location: "dist" #Built app content directory - optional
```
</details>
- ഡിപ്ലോയ്‌മെന്റിന് ശേഷം: 'Go to Deployment' ശേഷം 'View app in browser' ക്ലിക്ക് ചെയ്യുക.
നിങ്ങളുടെ GitHub Action (വർക്ക്‌ഫ്ലോ) വിജയകരമായി പ്രവർത്തിച്ചശേഷം, നിങ്ങളുടെ ആപ്പ് കാണുവാൻ തത്സമയം പേജ് റിഫ്രഷ് ചെയ്യുക.
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**അസൂയാചകം**:
ഈ രേഖ AI അനുഭവം ഉപയോഗിച്ച് [കോ-ഓപ് ട്രാൻസ്ലേറ്റർ](https://github.com/Azure/co-op-translator) എന്ന അന്വയം സേവനം ഉപയോഗിച്ച് ബഹുഭാഷയാക്കി രൂപാന്തരം ചെയ്തതാണ്. ഞങ്ങൾ നിശ്ചിതത്വത്തിനായി ശ്രമിച്ചിട്ടും, സ്വയംകൃതപ്പെടുന്ന വിവർത്തനങ്ങളിൽ പിശകുകളും അച്ചടക്കക്കുറവുകളും ഉണ്ടായേക്കാമെന്ന് ദയവായി ശ്രദ്ധിക്കുക. സ്വന്തം ഭാഷയിലെ മൗലിക രേഖയാണ് സത്യസന്ധമായ ഉറവിടം എന്ന നിലയിൽ കണക്കാക്കേണ്ടത്. നിർണ്ണായകമായ വിവരങ്ങൾക്കായി, പ്രൊഫഷണൽ മാനവ വിവർത്തനം ശുപാർശ ചെയ്യപ്പെടുന്നു. ഈ വിവർത്തനം ഉപയോഗിക്കുന്നതിന്റെ ഭാഗമായി ഉണ്ടായ എത്രവും തെറ്റിദ്ധാരണകൾക്കും ഞങ്ങൾ ഉത്തരവാദികളല്ല.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,863 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "d45ddcc54eb9232a76d08328b09d792e",
"translation_date": "2026-01-08T20:01:06+00:00",
"source_file": "1-getting-started-lessons/1-intro-to-programming-languages/README.md",
"language_code": "pcm"
}
-->
# Introduction to Programming Languages and Modern Developer Tools
Hey deh, future developer! 👋 Make I yan you wetin dey always give me goosebumps every single day? You dey ready to sabi say programming no be only about computers e be like say you get actual superpowers to bring your wildest ideas come life!
You sabi dat moment wen you dey use your favorite app and e just dey work perfectly? Wen you tap one button and something magical happen wey go make you talk "wow, how dem take DO am?" Well, na person just like you fit be wey dey sit for dem favorite coffee shop for 2 AM with their third espresso na im write the code wey create that magic. And make I yan you wetin go scatter your brain: by the end of this lesson, you no go only understand how dem take do am, you go dey excited to try am yourself!
Look, I understand am if programming fit dey scare you now. When I first start, I really believe say you need to be some kind math genius or say you don dey code since you be small pikin. But wetin change my mind completely be say: programming na just like learning how to talk for new language. You go start with "hello" and "thank you," then you go move go ordering coffee, and before you know am, you dey talk serious tori! But for this case, na computer you dey talk to, and honestly? Dem be the most patient padi wey you fit get dem no dey judge your mistake and dem dey ready to try again anytime!
Today, we go explore the correct tools wey dey make modern web development no be only possible, but e also dey very addictive. I dey talk about the same editors, browsers, and workflows wey developers for Netflix, Spotify, and your favorite indie app studio dey use every single day. And here na the part wey go make you dance with joy: most of these professional-grade, industry-standard tools na totally free!
![Intro Programming](../../../../translated_images/webdev101-programming.d6e3f98e61ac4bff.pcm.png)
> Sketchnote by [Tomomi Imura](https://twitter.com/girlie_mac)
```mermaid
journey
title Your Programming Journey Today
section Discover
Wetin be Programming: 5: You
Programming Languages: 4: You
Tools Overview: 5: You
section Explore
Code Editors: 4: You
Browsers & DevTools: 5: You
Command Line: 3: You
section Practice
Language Detective: 4: You
Tool Exploration: 5: You
Community Connection: 5: You
```
## Make We See Wetin You Sabi Before!
Before we jump enter di fun matter dem, I dey curious wetin you don sabi about dis programming world? And make you hear me, if you dey look these questions dey think "I no understand anything about any of dis," no wahala at all, e perfect! That one mean say you dey exactly the correct place. Make you think of dis quiz like exercise before workout we dey just warm up brain muscles!
[Take the pre-lesson quiz](https://forms.office.com/r/dru4TE0U9n?origin=lprLink)
## The Adventure We Dey Go Together
Okay, I dey really happy for wetin we go explore today! Seriously, I wish say I fit see your face wen some of these things go click for your head. Here na the amazing journey we go take together:
- **Wetin programming really be (and why e be the coolest thing ever!)** We go learn how code na the invisible magic wey dey power everything for your side, from that alarm wey sabi say na Monday morning be this, to the algorithm wey beta arrange your Netflix recommendations
- **Programming languages and their different personalities** Imagine say you dey waka enter party and everybody get different superpowers and ways to solve problem. That na how programming language world dey be, and you go enjoy to meet dem!
- **The basic building blocks wey make digital magic happen** Think am like the best creative LEGO set. Once you sabi how these parts join together, you go realize say you fit build anything way your imagination talk
- **Professional tools wey go make you feel like person wey get wizard wand** I no dey exaggerate here these tools go really make you feel say you get superpowers, and the best part? Na the same ones pros dey use!
> 💡 **Here na the mata**: No even try memorize everything today! Now now, I just want make you see the excitement about wetin fit happen. The small small details go sure naturally as we dey practice together na so real learning dey happen!
> You fit do this lesson for [Microsoft Learn](https://docs.microsoft.com/learn/modules/web-development-101/introduction-programming/?WT.mc_id=academic-77807-sagibbon)!
## So Wetin Exactly *Be* Programming?
Alright, make we tackle the big question: wetin be programming, really?
I go tell you story wey totally change how I dey see this matter. Last week, I dey try explain to my mama how to use our new smart TV remote. I catch myself dey talk like "Press the red button, but no be the big red button, na the small red button for left... no, your other left... okay, hold am for two seconds, no be one, no be three..." E sound familiar? 😅
That na programming! Na art of giving very detailed, step by step instructions to something wey powerful but need make you talk am well well. Except say no be to your mama you dey explain (wey fit ask "which red button?!"), na computer you dey talk to (wey just dey do exactly wetin you talk, even if wetin you talk no be wetin you mean).
Make I talk wetin scatter my mind when I first learn this: computers be actually pretty simple for inside. Dem only sabi two things 1 and 0, wey be basically "yes" and "no" or "on" and "off." Na im e be! But the magic come be say we no need talk 1 and 0 like say we dey The Matrix. Na so programming languages enter the matter. Dem be like say you get the best translator wey dey take your normal human brain talk and turn am to computer language.
And the thing wey still dey give me goosebumps every morning when I wake up be say: everything digital for your life start from person wey just like you, fit dey with pajamas, sip coffee, dey type code for laptop. That Instagram filter wey make you fine? Somebody code am. The recommendation wey bring your new favorite song? Developer build that algorithm. The app wey help you divide dinner bills with your padi dem? Ehn, person talk say "this one dey bother, I fit fix am" and then... dem fix am!
When you learn programming, you no dey just gain new skill you join one amazing community of people wey dey solve problem. Dem dey spend dia days dey think, "Wetin if I fit build something wey go make person day better small?" Honestly, e get anything wey sweet pass that?
**Fun Fact Hunt**: Here na some beta tins to check when you get free time who you think na the worlds first computer programmer? I go give you hint: e no fit be who you expect! The story behind this person na fascinating one and e show say programming don always be about creative problem-solving and thinking outside the box.
### 🧠 **Check-in Time: How You Dey Feel?**
**Take small time to think:**
- E make sense to you now say "giving instructions to computers" mean?
- You fit think of one daily work wey you fit automate with programming?
- Wetin questions dey your mind about this whole programming matter?
> **Remember**: E normal if some of the ideas dey confuse you now. Learning programming na like learning new language e take time make your brain build the pathways. You dey do well!
## Programming Languages Be Like Different Flavors Of Magic
Okay, this one go sound funny, but stay with me programming languages dey like different types of music. Think am: you get jazz wey smooth and free style, rock wey powerful and straight forward, classical wey sophisticated and arranged well, plus hip-hop wey creative and expressive. Each style get dia own vibe, dia own fans wey full passion, and each one perfect for different mood and occasion.
Programming languages dey work same way! You no go use the same language to build fun mobile game wey you go use to process plenty climate data, just like you no go play death metal for yoga class (well, most yoga classes sef! 😄).
But wetin dey scatter my mind every time I think about am be say: these languages be like say you get the patientst, smartest interpreter for di world wey sidon gidigba beside you. You fit express your ideas naturally as human, and dem go do all the waka to turn am into 1s and 0s wey computer sabi talk. E be like say you get padi wey fluent for both "human creativity" and "computer logic" and dem no dey tire, no dey need coffee break, and dem no ever dey judge you if you ask same question two times!
### Popular Programming Languages and Their Uses
```mermaid
mindmap
root((Programming Languages))
Web Development
JavaScript
Frontend Magic
Interactive Websites
TypeScript
JavaScript + Types
Enterprise Apps
Data & AI
Python
Data Science
Machine Learning
Automation
R
Statistics
Research
Mobile Apps
Java
Android
Enterprise
Swift
iOS
Apple Ecosystem
Kotlin
Modern Android
Cross-platform
Systems & Performance
C++
Games
Performance Critical
Rust
Memory Safety
System Programming
Go
Cloud Services
Scalable Backend
```
| Language | Best For | Why It's Popular |
|----------|----------|------------------|
| **JavaScript** | Web development, user interfaces | E dey run for browsers and e dey power interactive websites |
| **Python** | Data science, automation, AI | Easy to read and sabi, powerful libraries |
| **Java** | Enterprise applications, Android apps | E no depend on platform, e strong for big big systems |
| **C#** | Windows applications, game development | E get strong Microsoft ecosystem support |
| **Go** | Cloud services, backend systems | Fast, simple, e design for modern computing |
### High-Level vs. Low-Level Languages
Okay, this one na the concept wey scatter my brain when I first start learning, so I go tell you analogy wey make am clear for me I hope e help you also!
Imagine say you dey visit country wey you no sabi language, and you really need find nearest toilet (everybodi don waka this road, abi? 😅):
- **Low-level programming** na like say you sabi the local dialect well well, so you fit yan the old woman wey dey sell fruit corner this corner wit cultural things, local slang, and inside jokes wey only person wey grow there go understand. E sweet and very efficient... if you fluent! But e go just stress you if na only restroom you dey find.
- **High-level programming** na like say you get beta local padi wey understand you well. You fit talk "I really need to find restroom" for plain English, and e go translate everything and carry you go the toilet in way wey your non-local brain go understand.
For programming:
- **Low-level languages** (like Assembly or C) dey allow you talk detailed talk with computer actual hardware, but you must reason like machine, which be... ehn, make we just say e big mental adjustment!
- **High-level languages** (like JavaScript, Python, or C#) dey let you think like human while dem dey do all the machine talk for back scenes. Plus, dem get communities full of people wey remember when dem be new and dey really ready to help!
Guess which one I go tell you make you start with? 😉 High-level languages na like training wheels wey you no even want remove because dem just dey make am better to learn!
```mermaid
flowchart TB
A["👤 Human Thought:<br/>'I wan calculate Fibonacci numbers'"] --> B{Choose Language Level}
B -->|High-Level| C["🌟 JavaScript/Python<br/>Easy to read and write"]
B -->|Low-Level| D["⚙️ Assembly/C<br/>Direct hardware control"]
C --> E["📝 Write: fibonacci(10)"]
D --> F["📝 Write: mov r0,#00<br/>sub r0,r0,#01"]
E --> G["🤖 Computer Understanding:<br/>Translator dey handle complexity"]
F --> G
G --> H["💻 Same Result:<br/>0, 1, 1, 2, 3, 5, 8, 13..."]
style C fill:#e1f5fe
style D fill:#fff3e0
style H fill:#e8f5e8
```
### Make I Show You Why High-Level Languages Dey More Friendly
Alright, I go show you something wey go show why I fall in love with high-level languages, but first make you promise me one thing. When you see that first code example, no fear! E suppose look like say e heavy. Na exactly wetin I dey yan be that!
We go look the same task wey write for two complete different styles. Both go create wetin dem dey call Fibonacci sequence na beautiful mathematical pattern wey every number na the sum of the two number before am: 0, 1, 1, 2, 3, 5, 8, 13... (Fun fact: you go find this pattern everywhere for nature like sunflower seed spirals, pine cone shapes, even galaxy way dem form!)
Ready to see di difference? Make we go!
**High-level language (JavaScript) Human-friendly:**
```javascript
// Step 1: Basic Fibonacci setup na so we go start Fibonacci setup
const fibonacciCount = 10;
let current = 0;
let next = 1;
console.log('Fibonacci sequence:');
```
**Dis code dey do this:**
- **Declare** constant wey go talk how many Fibonacci number we go generate
- **Initialize** two variables to track current and next number for sequence
- **Set up** starting values (0 and 1) wey define Fibonacci pattern
- **Show** one header message to identify our output
```javascript
// Step 2: Make di sequence wit loop
for (let i = 0; i < fibonacciCount; i++) {
console.log(`Position ${i + 1}: ${current}`);
// Calculate di next number for di sequence
const sum = current + next;
current = next;
next = sum;
}
```
**Make we break down wetin dey happen here:**
- **Loop** through every position for our sequence using `for` loop
- **Show** each number with im position using template literal formatting
- **Calculate** next Fibonacci number by adding current and next values
- **Update** our tracking variables to move to next number
```javascript
// Step 3: How we dey do am wit new style
const generateFibonacci = (count) => {
const sequence = [0, 1];
for (let i = 2; i < count; i++) {
sequence[i] = sequence[i - 1] + sequence[i - 2];
}
return sequence;
};
// How you go take use am example
const fibSequence = generateFibonacci(10);
console.log(fibSequence);
```
**For this one, we:**
- **Create** reusable function using modern arrow function syntax
- **Build** array to store complete sequence instead of showing one by one
- **Use** array indexing to calculate each new number from previous ones
- **Return** complete sequence to use anyhow for other parts of program
**Low-level language (ARM Assembly) Computer-friendly:**
```assembly
area ascen,code,readonly
entry
code32
adr r0,thumb+1
bx r0
code16
thumb
mov r0,#00
sub r0,r0,#01
mov r1,#01
mov r4,#10
ldr r2,=0x40000000
back add r0,r1
str r0,[r2]
add r2,#04
mov r3,r0
mov r0,r1
mov r1,r3
sub r4,#01
cmp r4,#00
bne back
end
```
Notice how JavaScript version read like English instructions, but Assembly version get secret commands wey control computer processor directly. Both do the exact same work, but the high-level language easy for humans to understand, write, and maintain.
**Key difference wey you go notice:**
- **Readability**: JavaScript dey use names like `fibonacciCount` wey clear, but Assembly dey use codes like `r0`, `r1`
- **Comments**: High-level languages dey encourage explanatory comments wey dey make code self-documenting
- **Structure**: JavaScript logical flow dey match how humans dey think about problems step-by-step
- **Maintenance**: Updating the JavaScript version for different requirements easy and clear
**About the Fibonacci sequence**: Dis absolutely beautiful number pattern (where each number equals di sum of di two before am: 0, 1, 1, 2, 3, 5, 8...) dey show up literally *everywhere* for nature! You go find am for sunflower spirals, pinecone patterns, di way nautilus shells dey curve, and even for how tree branches grow. E dey pretty mind-blowing how math and code fit help us understand and recreate di patterns wey nature dey use to create beauty!
## The Building Blocks That Make the Magic Happen
Alright, now wey you don see how programming languages dey act, make we break down di fundamental pieces wey dey make up literally every program wey dem don write. Think of these as di essential ingredients for your favorite recipe once you sabi wetin each one dey do, you go fit read and write code for almost any language!
Dis na like learning di grammar of programming. Remember for school when you learn about nouns, verbs, and how to put sentences together? Programming get him own version of grammar, and honestly, e dey way more logical and forgiving pass English grammar! 😄
### Statements: The Step-by-Step Instructions
Make we start with **statements** dem be like individual sentences wey you dey yarn with your computer. Each statement dey tell di computer to do one specific thing, just like giving directions: "Turn left here," "Stop for di red light," "Park for that spot."
Wetin I like about statements na how dem dey readable most times. Check dis out:
```javascript
// Simple talk wey dey do one kain work only
const userName = "Alex";
console.log("Hello, world!");
const sum = 5 + 3;
```
**Dis na wetin dis code dey do:**
- **Declare** one constant variable to store user name
- **Display** greeting message for di console output
- **Calculate** and store di result of one mathematical operation
```javascript
// Di talk dem wey dey interact wit web pages
document.title = "My Awesome Website";
document.body.style.backgroundColor = "lightblue";
```
**Step by step, dis na wetin dey happen:**
- **Modify** di webpage title wey dey appear for di browser tab
- **Change** di background color of di whole page body
### Variables: Your Program's Memory System
Okay, **variables** be one of my absolute favorite concepts to teach because dem dey just like things you dey use everyday!
Think about your phone contact list for one second. You no dey memorize everybody phone numbers you dey save "Mom," "Best Friend," or "Pizza Place Wey Dey Deliver Till 2 AM" and your phone dey remember di actual numbers. Variables dey work like dat! Dem be like labeled containers where your program fit store info and retrieve am later with one name wey make sense.
Wetin make am really cool: variables fit change as your program dey run (na why dem call am "variable" you see wetin dem do there?). Just like how you fit update dat pizza place contact if you find better one, variables fit dey updated as your program learn new info or as situation change!
Make I show you how simple e fit be:
```javascript
// Step 1: Di creating basic variables
const siteName = "Weather Dashboard";
let currentWeather = "sunny";
let temperature = 75;
let isRaining = false;
```
**Make you understand dis concepts:**
- **Store** values wey no go change for `const` variables (like site name)
- **Use** `let` for values wey fit change during your program
- **Assign** different data types: strings (text), numbers, and booleans (true/false)
- **Choose** descriptive names wey explain wetin each variable get inside
```javascript
// Step 2: Dey wok wit objects to group tings wey relate togeda
const weatherData = {
location: "San Francisco",
humidity: 65,
windSpeed: 12
};
```
**For di above, we:**
- **Create** one object to group related weather information
- **Organize** plenty pieces of data under one variable name
- **Use** key-value pairs to label each info clearly
```javascript
// Step 3: Di way wey you go take use an update di variables
console.log(`${siteName}: Today is ${currentWeather} and ${temperature}°F`);
console.log(`Wind speed: ${weatherData.windSpeed} mph`);
// How to update di variables wey fit change
currentWeather = "cloudy";
temperature = 68;
```
**Make we understand each part:**
- **Display** info with template literals using `${}` syntax
- **Access** object properties with dot notation (`weatherData.windSpeed`)
- **Update** variables wey dem declare with `let` to show changing conditions
- **Combine** multiple variables to create meaningful messages
```javascript
// Step 4: Modern destructuring make di code clean well well
const { location, humidity } = weatherData;
console.log(`${location} humidity: ${humidity}%`);
```
**Wetin you need sabi:**
- **Extract** specific properties from objects with destructuring assignment
- **Create** new variables automatically wey get same names as object keys
- **Simplify** code by avoiding repetitive dot notation
### Control Flow: Teaching Your Program to Think
Okay, na here programming go dey mind-blowing! **Control flow** na teaching your program how to make smart decisions, just like how you dey do every day without even think.
Imagine dis: this morning you for do something like "If e dey rain, I go carry umbrella. If e cold, I go wear jacket. If I late, I go skip breakfast and grab coffee on di way." Your brain naturally dey follow dis if-then logic many times every day!
Dis na wetin dey make programs dey feel intelligent and alive, no be only to follow boring, predictable script. Dem fit look situation, reason wetin dey happen, and respond well well. E be like giving your program brain wey fit adapt and make choices!
You want see how dis work nicely? Make I show you:
```javascript
// Step 1: Simple if-else ting dem
const userAge = 17;
if (userAge >= 18) {
console.log("You can vote!");
} else {
const yearsToWait = 18 - userAge;
console.log(`You'll be able to vote in ${yearsToWait} year(s).`);
}
```
**Dis na wetin dis code dey do:**
- **Check** if user age reach di voting requirement
- **Execute** different code blocks based on condition result
- **Calculate** and display how long before dem fit vote if dem still under 18
- **Provide** specific, helpful feedback for each case
```javascript
// Step 2: Plenty conditions wit logical operators
const userAge = 17;
const hasPermission = true;
if (userAge >= 18 && hasPermission) {
console.log("Access granted: You can enter the venue.");
} else if (userAge >= 16) {
console.log("You need parent permission to enter.");
} else {
console.log("Sorry, you must be at least 16 years old.");
}
```
**Break down wetin dey happen:**
- **Combine** multiple conditions with `&&` (and) operator
- **Create** hierarchy of conditions with `else if` for many scenarios
- **Handle** all possible cases with final `else` statement
- **Provide** clear and actionable feedback for each different situation
```javascript
// Step 3: Short condition wit ternary operator
const votingStatus = userAge >= 18 ? "Can vote" : "Cannot vote yet";
console.log(`Status: ${votingStatus}`);
```
**Wetin you need remember:**
- **Use** ternary operator (`? :`) for simple two-option conditions
- **Write** condition first, then `?`, then true result, then `:`, then false result
- **Apply** dis pattern when you want assign values based on conditions
```javascript
// Step 4: Dealing wit plenti particular kain cases
const dayOfWeek = "Tuesday";
switch (dayOfWeek) {
case "Monday":
case "Tuesday":
case "Wednesday":
case "Thursday":
case "Friday":
console.log("It's a weekday - time to work!");
break;
case "Saturday":
case "Sunday":
console.log("It's the weekend - time to relax!");
break;
default:
console.log("Invalid day of the week");
}
```
**Dis code dey do:**
- **Match** variable value against multiple specific cases
- **Group** similar cases together (weekdays vs weekends)
- **Execute** correct code block when match dey
- **Include** `default` case to handle unexpected values
- **Use** `break` statements to prevent code from running to next case
> 💡 **Real-world analogy**: Think of control flow like di world most patient GPS wey dey gimme directions. E go talk "If traffic dey Main Street, take highway instead. If construction block highway, try scenic route." Programs dey use same conditional logic make dem respond smartly to different things and always give user di best experience.
### 🎯 **Concept Check: Building Blocks Mastery**
**Make we see how you dey with fundamentals:**
- Fit explain difference between variable and statement with your own words?
- Think of real-world place where you fit use if-then decision (like our voting example)
- Wetin one thing about programming logic wey surprise you?
**Quick confidence booster:**
```mermaid
flowchart LR
A["📝 Statements<br/>(Instructions dem)"] --> B["📦 Variables<br/>(Storage)"] --> C["🔀 Control Flow<br/>(Decisions)"] --> D["🎉 Working Program!"]
style A fill:#ffeb3b
style B fill:#4caf50
style C fill:#2196f3
style D fill:#ff4081
```
**Wet tin dey come next**: We go enjoy as we dive deeper into these concepts for this incredible journey! Right now, just focus on that excitement about all di amazing possibilities wey dey front of you. Di specific skills and techniques go naturally stick as we practice together I promise say dis go sweet pass wetin you expect!
## Tools of the Trade
Okay, na here I dey really excited wey I fit barely contain! 🚀 We go talk about the amazing tools wey go make you feel like say dem don give you di keys to digital spaceship.
You sabi how chef get knives wey balance well well wey feel like part of im hand? Or how musician get guitar wey dey sing the moment dem touch am? Well, developers get our own magical tools, and here na wetin go blow your mind most of dem dey free!
I dey bounce for my chair just dey think about to share this with you because dem don change how we dey build software completely. We dey talk about AI-powered coding assistants wey fit help write your code (I no dey joke!), cloud environments where you fit build complete applications from anywhere with Wi-Fi, and debugging tools so waka deep dem be like X-ray vision for your programs.
And this one still get me chills: these no be beginner tools wey you go soon comot. Na the exact professional-grade tools wey developers for Google, Netflix, and that indie app studio wey you like dey use now now. You go feel like real pro using them!
```mermaid
graph TD
A["💡 Your Idea"] --> B["⌨️ Code Editor<br/>(VS Code)"]
B --> C["🌐 Browser DevTools<br/>(Testing & Debugging)"]
C --> D["⚡ Command Line<br/>(Automation & Tools)"]
D --> E["📚 Documentation<br/>(Learning & Reference)"]
E --> F["🚀 Amazing Web App!"]
B -.-> G["🤖 AI Assistant<br/>(GitHub Copilot)"]
C -.-> H["📱 Device Testing<br/>(Responsive Design)"]
D -.-> I["📦 Package Managers<br/>(npm, yarn)"]
E -.-> J["👥 Community<br/>(Stack Overflow)"]
style A fill:#fff59d
style F fill:#c8e6c9
style G fill:#e1f5fe
style H fill:#f3e5f5
style I fill:#ffccbc
style J fill:#e8eaf6
```
### Code Editors and IDEs: Your New Digital Best Friends
Make we talk about code editors dem go soon become your favorite places to hang out! Think of dem as your personal coding sanctuary where you go spend most of your time crafting and perfecting your digital work.
But dis one dey magical about modern editors: no be only fine text editors. Dem be like having best, most supportive coding mentor sit right beside you 24/7. Dem go catch your typo before you even sabi dem, suggest ways to make you look genius, help you understand every piece of code, and some even fit predict wetin you wan type next and offer to finish your mind!
I remember when I first find auto-completion I feel like I dey live for future. You go start to type, then your editor go talk, "Hey, you dey think about dis function wey go do wetin you need?" E be like say your coding buddy sabi your mind before you talk am!
**Wetin make these editors so incredible?**
Modern code editors get plenty features wey go boost your work productivity:
| Feature | What E Dey Do | Why E Dey Help |
|---------|--------------|--------------|
| **Syntax Highlighting** | Dey color different parts of your code | Make code easier to read and spot mistakes |
| **Auto-completion** | Dey suggest code as you type | Speed coding and reduce typos |
| **Debugging Tools** | Dey help find and fix errors | Save you many hours of troubleshooting |
| **Extensions** | Add special features | Customize your editor for any technology |
| **AI Assistants** | Suggest code and explanations | Fast learning and better productivity |
> 🎥 **Video Resource**: Want see these tools for action? Check dis [Tools of the Trade video](https://youtube.com/watch?v=69WJeXGBdxg) for full overview.
#### Recommended Editors for Web Development
**[Visual Studio Code](https://code.visualstudio.com/?WT.mc_id=academic-77807-sagibbon)** (Free)
- Most popular for web developers
- Excellent extension ecosystem
- Built-in terminal and Git integration
- **Must-have extensions**:
- [GitHub Copilot](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot) - AI-powered code suggestions
- [Live Share](https://marketplace.visualstudio.com/items?itemName=MS-vsliveshare.vsliveshare) - Real-time collaboration
- [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) - Automatic code formatting
- [Code Spell Checker](https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker) - Catch typos inside your code
**[JetBrains WebStorm](https://www.jetbrains.com/webstorm/)** (Paid, free for students)
- Advanced debugging and testing tools
- Intelligent code completion
- Built-in version control
**Cloud-Based IDEs** (Different pricing)
- [GitHub Codespaces](https://github.com/features/codespaces) - Full VS Code for your browser
- [Replit](https://replit.com/) - Great for learning and sharing code
- [StackBlitz](https://stackblitz.com/) - Instant, full-stack web development
> 💡 **Getting Started Tip**: Start with Visual Studio Code e free, e dey widely used for industry, and get big community wey dey create helpful tutorials and extensions.
### Web Browsers: Your Secret Development Laboratory
Okay, get ready to get your mind blow! You know how you dey use browsers to scroll social media and watch videos? Well, e turn out say browsers hide incredible secret developer laboratory all dis time, just dey wait make you find am!
Every time you right-click on webpage and choose "Inspect Element," na so you dey open one hidden world of developer tools wey really powerful pass some expensive software wey I use pay hundreds of dollars for before. E be like say your normal kitchen get professional chef laboratory behind secret panel!
Di fọs taim pesin show me browser DevTools, ah spent like three awas jus dey click around an dey talk "WAIT, E FIT DO DAT TOO?!" You fit edit any website for real-time, see exactly how fast everytin dey load, test how your site dey look for different devices, an even debug JavaScript like total pro. E really blow mind!
**Na why browsers be your secret weapon:**
When you dey create website or web application, you go need see how e dey look an behave for real life. Browsers no just show your work, dem dey give you detailed feedback about performance, accessibility, an potential wahala.
#### Browser Developer Tools (DevTools)
Modern browsers get full development suite:
| Tool Category | Wetin E Dey Do | Example Use Case |
|---------------|----------------|------------------|
| **Element Inspector** | View an edit HTML/CSS for real-time | Change style make you see quick result |
| **Console** | View error messages an test JavaScript | Debug gbege an try code |
| **Network Monitor** | Track how resources dey load | Make performance an loading sharp |
| **Accessibility Checker** | Test for inclusive design | Make sure say your site dey work for everybody |
| **Device Simulator** | Preview on different screen sizes | Test responsive design without many devices |
#### Recommended Browsers for Development
- **[Chrome](https://developers.google.com/web/tools/chrome-devtools/)** - Industry-standard DevTools wit full documentation
- **[Firefox](https://developer.mozilla.org/docs/Tools)** - Beta CSS Grid an accessibility tools
- **[Edge](https://docs.microsoft.com/microsoft-edge/devtools-guide-chromium/?WT.mc_id=academic-77807-sagibbon)** - Build on Chromium wit Microsoft developer resources
> ⚠️ **Important Testing Tip**: Always test your websites inside multiple browsers! Wetin work well for Chrome fit look different for Safari or Firefox. Professional developers dey test for all major browsers so user experience go dey consistent.
### Command Line Tools: Your Gateway to Developer Superpowers
Okay, mek we dey real here about command line, because I want make you hear from person wey understand am well well. When I first see am just dis scary black screen with blinking text I really think, "Nope, no way! E be like witchcraft from 1980s hacker movie, and I no smart reach dat level!" 😅
But na wetin I wish person don tell me back then an wat I dey tell you now be: command line no dey scary e be like direct talk with your computer. E be like differenc between ordering food from fancy app wit picture an menu (wey sweet an easy) versus enter your local restaurant where chef sabi wetin you like an fit make correct food when you just say "surprise me with something great."
Command line na where developers go feel like real wizards. You just type few magic words (okay na commands, but e dey feel magic!), press enter, an BOOM you don create whole project structure, install strong tools from anywhere, or deploy your app to internet for millions people to see. When you get first taste of dat power, e be like chain wey no fit break!
**Why command line go be your best tool:**
Even though GUI dey good for many tasks, command line dey excel for automation, precision, an speed. Plenty dev tools dey work mainly with command line interface, an learning how to use dem well fit boost your productivity no be small.
```bash
# Step 1: Make and waka go project folder
mkdir my-awesome-website
cd my-awesome-website
```
**Dis code dey do:**
- **Create** one new directory wey dem call "my-awesome-website" for your project
- **Navigate** inside dat new directory to start work
```bash
# Step 2: Start di project wit package.json
npm init -y
# Install beta development tools
npm install --save-dev vite prettier eslint
npm install --save-dev @eslint/js
```
**Step by step, dis na wetin dey happen:**
- **Initialize** new Node.js project with default settings using `npm init -y`
- **Install** Vite as modern build tool for fast development and production build
- **Add** Prettier for automatic code formatting an ESLint for code quality check
- **Use** `--save-dev` flag to mark these as development-only dependencies
```bash
# Step 3: Build di project structure and files
mkdir src assets
echo '<!DOCTYPE html><html><head><title>My Site</title></head><body><h1>Hello World</h1></body></html>' > index.html
# Start di development server
npx vite
```
**For above, we don:**
- **Organize** our project by creating separate folders for source code an assets
- **Generate** basic HTML file wit correct document structure
- **Start** Vite development server for live reload an hot module replacement
#### Essential Command Line Tools for Web Development
| Tool | Purpose | Why You Need Am |
|------|---------|-----------------|
| **[Git](https://git-scm.com/)** | Version control | Track changes, collaborate an backup work |
| **[Node.js & npm](https://nodejs.org/)** | JavaScript runtime & package management | Run JavaScript outside browser, install modern dev tools |
| **[Vite](https://vitejs.dev/)** | Build tool & dev server | Fast development wit hot module replacement |
| **[ESLint](https://eslint.org/)** | Code quality | Automatically find an fix problems for your JavaScript |
| **[Prettier](https://prettier.io/)** | Code formatting | Keep code consistent an easy to read |
#### Platform-Specific Options
**Windows:**
- **[Windows Terminal](https://docs.microsoft.com/windows/terminal/?WT.mc_id=academic-77807-sagibbon)** - Modern, feature-rich terminal
- **[PowerShell](https://docs.microsoft.com/powershell/?WT.mc_id=academic-77807-sagibbon)** 💻 - Powerful scripting environment
- **[Command Prompt](https://docs.microsoft.com/windows-server/administration/windows-commands/?WT.mc_id=academic-77807-sagibbon)** 💻 - Traditional Windows command line
**macOS:**
- **[Terminal](https://support.apple.com/guide/terminal/)** 💻 - Built-in terminal app
- **[iTerm2](https://iterm2.com/)** - Enhanced terminal wit advanced features
**Linux:**
- **[Bash](https://www.gnu.org/software/bash/)** 💻 - Standard Linux shell
- **[KDE Konsole](https://docs.kde.org/trunk5/en/konsole/konsole/index.html)** - Advanced terminal emulator
> 💻 = Pre-installed for operating system
> 🎯 **Learning Path**: Start wit basic commands like `cd` (change directory), `ls` or `dir` (list files), an `mkdir` (create folder). Practice wit modern workflow commands like `npm install`, `git status`, an `code .` (opens current directory in VS Code). As you dey comfortable, you go naturally learn advanced commands an automation techniques.
### Documentation: Your Always-Available Learning Mentor
Okay, mek I share small secret wey go make you feel better about being beginner: even the most experienced developers spend plenty time dey read documentation. An no be because dem no sabi wetin dem dey do e mean say dem dey wise!
Think documentation like you get access to world most patient, knowledgeable teacher wey dey available 24/7. You jam gbege for 2 AM? Documentation dey give you warm virtual hug an exactly di answer wey you need. You want learn about beta new thing wey everybody dey talk? Documentation get your back wit step-by-step example. You dey try sabi why something dey work like dat? You don guess am documentation ready to explain am so e go clear finally!
Here na wetin change my mind: web development world dey move sharp sharp, an nobody (I mean nobody!) fit remember everything. I don watch senior devs with 15+ years experience dey look basic syntax, and you know? E no shame na smart thing be dat! E no mean say memory perfect; na to sabi where to find correct answer fast an understand how to apply am.
**Na here di real magic dey:**
Professional developers spend big part of their time dey read documentation no be because dem no sabi, but because web development landscape dey change fast so dem need dey learn continuously. Great documentation go help you understand not just *how* to use somtin, but *why* an *when* to use am.
#### Essential Documentation Resources
**[Mozilla Developer Network (MDN)](https://developer.mozilla.org/docs/Web)**
- Gold standard for web technology documentation
- Comprehensive guides for HTML, CSS an JavaScript
- Browser compatibility info inside
- Get practical examples an interactive demos
**[Web.dev](https://web.dev)** (by Google)
- Modern web development best practices
- Performance optimization guides
- Accessibility an inclusive design principles
- Case studies from real projects
**[Microsoft Developer Documentation](https://docs.microsoft.com/microsoft-edge/#microsoft-edge-for-developers)**
- Edge browser development resources
- Progressive Web App guides
- Cross-platform dev insights
**[Frontend Masters Learning Paths](https://frontendmasters.com/learn/)**
- Structured learning curricula
- Video courses from industry experts
- Hands-on coding exercises
> 📚 **Study Strategy**: No try memorize documentation better learn how to navigate am well. Bookmark references you use dey-time to time an practice to find info fast with search.
### 🔧 **Tool Mastery Check: Wetin Dey Resonate With You?**
**Take small time to think:**
- Which tool you dey excited to try first? (No wrong answer!)
- Command line still dey scare you or you get curiosity about am?
- You go fit use browser DevTools to peek behind curtain for your favorite websites?
```mermaid
pie title "How Developer Dey Spend Time Wit Tools"
"Code Editor" : 40
"Browser Testing" : 25
"Command Line" : 15
"Reading Docs" : 15
"Debugging" : 5
```
> **Fun insight**: Majority developers spend about 40% of their time for their code editor, but observe how much time dey go for testing, learning, an problem-solving. Programming no be only to write code na to create experience!
**Food for thought**: Think about dis how tools for building websites (development) dey different from tools for designing how dem go look (design)? E be like differenc between architect wey design beautiful house an contractor wey build am. Both important, but need different tools! Dis kind thinking go help you see bigger picture of how websites dem come alive.
## GitHub Copilot Agent Challenge 🚀
Use Agent mode complete dis challenge:
**Description:** Explore features of modern code editor or IDE an show how e fit improve your workflow as web developer.
**Prompt:** Choose code editor or IDE (like Visual Studio Code, WebStorm, or cloud-based IDE). List three features or extensions wey help you write, debug, or maintain code fast. For each, give short explanation how e benefit your workflow.
---
## 🚀 Challenge
**Alright detective, you ready for your first case?**
Now wey you get this solid foundation, I get adventure wey go help you see how diverse an fascinating programming world be. And listen no be to write code yet, so no pressure! Think of yourself as programming language detective on your first exciting case!
**Your mission, if you accept am:**
1. **Become language explorer**: Pick three programming languages wey from different worlds maybe one for building websites, one for mobile apps, an one for crunching scientific data. Find example of same simple task written for every language. I promise you go shock how different dem go look but e still do same tins!
2. **Discover dem origin story**: Wetin make each language special? One cool fact every programming language come because pesin believe “I think sey beta way dey solve dis kind problem.” Fit you know wetin those problems be? Some story dey really interesting!
3. **Meet the communities**: Check how friendly an passionate each language community be. Some get millions dev dey share knowledge an help each other, others small but tight an supportive. You go enjoy see dem different personalities!
4. **Follow your gut feeling**: Which language you feel more comfortable wit? No stress to pick perfect one just listen to your heart! No wrong answer here, you fit explore more later.
**Bonus detective work**: Try find out which big websites or apps dem build with each language. I garranty sey you go shock to sabi wetin power Instagram, Netflix, or that mobile game wey you no fit stop to play!
> 💡 **Remember**: You no dey try become expert for any language today. You just dey sabi neighborhood before you choose where you want build. Take your time, enjoy am, an follow your curiosity!
## Make We Celebrate Wetin You Don Learn!
Holy moly, you don absorb plenty correct info today! I happy to see how much of this journey don stick for your head. And remember no be test wey you must get everything correct. Na celebration of all the beta tins you don learn about dis beautiful world you dey prepare to enter!
[Take the post-lesson quiz](https://ff-quizzes.netlify.app/web/)
## Review & Self Study
**Take your time to explore and have fun with it!**
You don cover beta tins today, and dat one na beta tins to dey proud of! Now na di fun part to explore di tins wey catch your mind. Make you remember, dis no be homework na adventure!
**Dive deeper into what excites you:**
**Make you try di programming languages:**
- Visit di official websites of 2-3 languages wey catch your eye. Each get im own character and story!
- Try some online coding playgrounds like [CodePen](https://codepen.io/), [JSFiddle](https://jsfiddle.net/), or [Replit](https://replit.com/). No fear to try you no fit spoil anything!
- Read how your favorite language take start. True true, some origin stories beta well well and e go help you understand why languages dey work like dat.
**Make you sabi di new tools:**
- Download Visual Studio Code if you never download e free and you go like am!
- Spend small time to waka inside di Extensions marketplace. E bi like app store for your code editor!
- Open your browser Developer Tools and just dey click around. No worry to sabi everything just dey familiar with wetin dey.
**Join di community:**
- Follow some developer communities for [Dev.to](https://dev.to/), [Stack Overflow](https://stackoverflow.com/), or [GitHub](https://github.com/). Di programming community dey very friendly to new people!
- Watch beginner coding videos for YouTube. Plenty beta creators wey sabi how e be to just start.
- Think about to join local meetups or online communities. Believe me, developers love to help new pipo!
> 🎯 **Listen, na wetin I want you to remember be dis**: No expect to become coding wizard overnight! Now, you just dey know dis amazing new world wey you about enter. Take your time, enjoy di journey, and remember every developer wey you sabi dey admire, dem bin dey your same place before, excited and maybe small confuse. E normal, and e mean say you dey do well!
## Assignment
[Reading the Docs](assignment.md)
> 💡 **Small push for your assignment**: I go like see you explore some tools we never talk before! No look editors, browsers, and command line tools wey we don yam plenty beta development tools dey wey you fit discover. Find ones wey dey actively maintained and get strong, helpful communities (dem get best tutorials and most supportive pipo when you jam problem and need help).
---
## 🚀 Your Programming Journey Timeline
### ⚡ **Wetin you fit do for next 5 minutes**
- [ ] Bookmark 2-3 programming language websites wey catch your eye
- [ ] Download Visual Studio Code if you never download
- [ ] Open your browser DevTools (F12) and just click around any website
- [ ] Join one programming community (Dev.to, Reddit r/webdev, or Stack Overflow)
### ⏰ **Wetin you fit complete this hour**
- [ ] Finish di post-lesson quiz and think about your answers
- [ ] Set up VS Code with di GitHub Copilot extension
- [ ] Try "Hello World" example for 2 different programming languages online
- [ ] Watch "Day in the Life of a Developer" video for YouTube
- [ ] Start your programming language detective work (from di challenge)
### 📅 **Your week-long adventure**
- [ ] Finish di assignment and explore 3 new development tools
- [ ] Follow 5 developers or programming accounts for social media
- [ ] Try build small tin for CodePen or Replit (even just "Hello, [Your Name]!")
- [ ] Read one developer blog post about coding journey
- [ ] Join virtual meetup or watch one programming talk
- [ ] Start learning your chosen language with online tutorials
### 🗓️ **Your month-long transformation**
- [ ] Build your first small project (even simple webpage counts!)
- [ ] Contribute to open-source project (start with documentation fixes)
- [ ] Mentor person wey just start their programming journey
- [ ] Create your developer portfolio website
- [ ] Connect with local developer communities or study groups
- [ ] Start to plan your next learning milestone
### 🎯 **Final reflection check-in**
**Before you move on, celebrate small:**
- Wetin be one thing about programming wey excited you today?
- Which tool or concept you want explore first?
- How you feel about starting dis programming journey?
- Wetin be one question you go like ask developer now?
```mermaid
journey
title Your Confidence Building Journey
section Today
Curious: 3: You
Overwhelmed: 4: You
Excited: 5: You
section This Week
Exploring: 4: You
Learning: 5: You
Connecting: 4: You
section Next Month
Building: 5: You
Confident: 5: You
Helping Others: 5: You
```
> 🌟 **Remember**: Every expert bin be beginner once. Every senior developer bin feel just like you dey feel now excited, maybe small confuse, and sure about wetin fit happen. You dey beta company, and dis journey go sweet well well. Welcome to di wonderful world of programming! 🎉
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document don get AI translation from [Co-op Translator](https://github.com/Azure/co-op-translator). Even though we try make e correct, abeg sabi say automated translation fit get mistake or no proper. Di original document for dia language na di correct one to trust. If na serious information, better make professional human person translate am. We no gree take responsibility if person no understand well or if person miss the meaning because of dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,78 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "17b8ec8e85d99e27dcb3f73842e583be",
"translation_date": "2026-01-08T20:21:20+00:00",
"source_file": "1-getting-started-lessons/1-intro-to-programming-languages/assignment.md",
"language_code": "pcm"
}
-->
# Assignment: Exploring Modern Web Development Tools
## Instructions
The web development ecosystem include plenti special tools wey dey help developers build, test, and maintain applications well well. Your work na to research and sabi tools wey go complete the ones wey this lesson cover.
**Your Mission:** Choose **three tools** wey **this lesson no talk about** (no choose code editors, browsers, or command line tools wey dem don list before). Make you focus on tools wey solve particular gbege for modern web development workflow.
**For each tool, give:**
1. **Tool name and category** (ex: "Figma - Design Tool" or "Jest - Testing Framework")
2. **Purpose and benefits** - Explain for 2-3 sentences why web developer go use this tool and which kind gbege e dey solve
3. **Official documentation link** - Put link to the tool official docs or website (no na just tutorial sites)
4. **Real-world context** - Talk one way wey this tool dey fit inside professional development workflow
## Suggested Tool Categories
Try explore tools from these categories:
| Category | Examples | What They Do |
|----------|----------|--------------|
| **Build Tools** | Vite, Webpack, Parcel, esbuild | Dem bundle and optimize code for production with fast development servers |
| **Testing Frameworks** | Vitest, Jest, Cypress, Playwright | Dem make sure code correct and catch bugs before deployment |
| **Design Tools** | Figma, Adobe XD, Penpot | Dem dey create mockups, prototypes, and design systems together |
| **Deployment Platforms** | Netlify, Vercel, Cloudflare Pages | Dem host and distribute websites with automatic CI/CD |
| **Version Control** | GitHub, GitLab, Bitbucket | Dem manage code changes, collaboration, and project workflows |
| **CSS Frameworks** | Tailwind CSS, Bootstrap, Bulma | Dem quicken styling with pre-built component libraries |
| **Package Managers** | npm, pnpm, Yarn | Dem install and manage code libraries and dependencies |
| **Accessibility Tools** | axe-core, Lighthouse, Pa11y | Dem test for inclusive design and WCAG compliance |
| **API Development** | Postman, Insomnia, Thunder Client | Dem dey test and document APIs while development dey happen |
## Format Requirements
**For each tool:**
```
### [Tool Name] - [Category]
**Purpose:** [2-3 sentences explaining why developers use this tool]
**Documentation:** [Official website/documentation link]
**Workflow Integration:** [1 sentence about how it fits into development process]
```
## Quality Guidelines
- **Choose current tools**: Pick tools wey dem still dey maintain and plenty people sabi for 2025
- **Focus on value**: Talk the exact benefits, no be just wetin the tool dey do
- **Professional context**: Think about tools wey development teams dey use, no be only individual hobbyists
- **Diverse selection**: Choose tools from different categories to show wide ecosystem
- **Modern relevance**: Pick tools wey align with current web development trends and best practices
## Rubric
| Excellent | Good | Needs Improvement |
|-----------|------|-------------------|
| **Clear explain why developers dey use each tool and which problems e dey solve** | **Explained wetin the tool do but miss some context about e value** | **Only list tools no explain wetin dem dey do or benefits** |
| **Give official documentation links for all tools** | **Mostly give official links but 1-2 tutorial sites dey too** | **Mainly give tutorial sites no official docs** |
| **Pick current, professionally-used tools from wide categories** | **Pick good tools but category variety no too much** | **Choose old tools or only one category** |
| **Show understanding of how tools dey fit into development workflows** | **Show small understanding for professional context** | **Only focus on tool features no workflow context** |
> 💡 **Research Tip**: Try find tools wey dey job postings for web developers, check popular developer surveys, or look through dependencies wey successful open-source projects use for GitHub!
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document na wetin AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator) translate am. Even though we try to make am correct, make you sabi say automated translation fit get mistake or no too clear. Di original document wey e dey for im own language na di correct one. For important mata, make person wey sabi human translation do am. We no go responsible if anybody no understand well or if e mean different thing because of dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,777 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "5c383cc2cc23bb164b06417d1c107a44",
"translation_date": "2026-01-08T20:24:27+00:00",
"source_file": "1-getting-started-lessons/2-github-basics/README.md",
"language_code": "pcm"
}
-->
# Introduction to GitHub
Hey dia, future developer! 👋 Ready to join millions of coders all over di world? I truly dey excited to introduce you to GitHub make you think am as social media platform for programmers, but instead of dey share pictures of your lunch, we dey share code and dey build amazing tins together!
Dis na wetin really anni blow my mind: every app for your phone, every website wey you dey visit, and most of di tools wey you go learn to use, na teams of developers collaborate for platforms like GitHub build dem. That music app wey you like? Person like you contribute for am. That game wey you no fit drop? Yes, e fit be sey dem build am with GitHub collaboration. And now YOU go learn how to join dat wonderful community!
I sabi sey e fit feel like plenti tins at first heck, I remember sey I look my first GitHub page dey wonder "Wetin dis tins mean for ground?" But here be di koko: every single developer start exactly where you dey right now. By di end of dis lesson, you go get your own GitHub repository (think am as your personal project showcase for cloud), and you go sabi how to save your work, share am with oda people, and even join contribute for projects wey millions of people dey use.
We go take dis travel together, one step at a time. No rush, no pressure na just you, me, and some really cool tools wey go turn your new best friends!
![Intro to GitHub](../../../../translated_images/webdev101-github.8846d7971abef6f9.pcm.png)
> Sketchnote by [Tomomi Imura](https://twitter.com/girlie_mac)
```mermaid
journey
title Your GitHub Adventure Today
section Setup
Install Git: 4: You
Create Account: 5: You
First Repository: 5: You
section Master Git
Local Changes: 4: You
Commits & Pushes: 5: You
Branching: 4: You
section Collaborate
Fork Projects: 4: You
Pull Requests: 5: You
Open Source: 5: You
```
## Pre-Lecture Quiz
[Pre-lecture quiz](https://ff-quizzes.netlify.app)
## Introduction
Before we jump enter really exciting tins, make we ready your computer for some GitHub magic! Think am like sey you dey organize your art supplies before you begin create tori masterpiece when your tools dey ready, everything go dey smooth and fun well well.
I go waka you through every setup step personally, and I promise sey e no fit too scary as e fit look for first. If anything no clear immediately, no wahala! I remember sey I set up my first development environment and e be like sey I dey try read ancient hieroglyphics. Every single developer don dey exactly where you dey now, dey wonder if dem dey do am correct. Spoiler alert: if you dey here dey learn, you don dey do am correct already! 🌟
For dis lesson, we go cover:
- how to track the work wey you do for your machine
- how to work on projects with oda people
- how to contribute to open source software
### Prerequisites
Make we ready your computer for some GitHub magic! No worry dis setup na tin wey you go do once, then you go dey ready for your whole coding journey.
Okay, make we start with di foundation! First, we need check if Git already dey your computer. Git na like super-smart assistant wey dey remember every change you make to your code better well pass to dey press Ctrl+S every two seconds (we don all do am!).
Make we see if Git don install by typing dis magic command for your terminal:
`git --version`
If Git never dey there yet, no wahala! Just go [download Git](https://git-scm.com/downloads) and grab am. After you don install am, we need show Git who you be properly:
> 💡 **First Time Setup**: These commands go tell Git who you be. Dis info go join every commit wey you make, so choose name and email wey you comfortable to show publicly.
```bash
git config --global user.name "your-name"
git config --global user.email "your-email"
```
To check if Git don configure already you fit type:
```bash
git config --list
```
You go also need GitHub account, code editor (like Visual Studio Code), and you go need open your terminal (or: command prompt).
Go [github.com](https://github.com/) and create account if you never create before, or log in and fill your profile.
💡 **Modern tip**: Try set up [SSH keys](https://docs.github.com/en/authentication/connecting-to-github-with-ssh) or use [GitHub CLI](https://cli.github.com/) to make authentication easy without need password.
✅ GitHub no be di only code repository for world; others dey, but GitHub na di most known
### Preparation
You go need folder with code project for your local machine (laptop or PC), plus public repository for GitHub, wey go serve as example how to contribute to projects of others.
### Keeping Your Code Safe
Make we yan about security small but no worry, we no go drown you for scary tins! Think of these security habits like you dey lock your car or house. Na simple habits wey go become part of your routine and go protect your hard work.
We go show you modern, secure ways to work with GitHub from start. This way, you go develop good habits wey go serve you well for your whole coding career.
When you dey work with GitHub, e important to follow security best practices:
| Security Area | Best Practice | Why It Matters |
|---------------|---------------|----------------|
| **Authentication** | Use SSH keys or Personal Access Tokens | Passwords no too secure again and dem dey phase them out |
| **Two-Factor Authentication** | Enable 2FA for your GitHub account | E add extra protection layer for your account |
| **Repository Security** | No ever commit sensitive info | API keys and passwords no suppose dey public repos |
| **Dependency Management** | Enable Dependabot for updates | E dey keep your dependencies secure and updated |
> ⚠️ **Critical Security Reminder**: No ever commit API keys, passwords, or any sensitive info to any repo. Use environment variables and `.gitignore` files to protect sensitive data.
**Modern Authentication Setup:**
```bash
# Make SSH key (new ed25519 algorithm)
ssh-keygen -t ed25519 -C "your_email@example.com"
# Arrange Git make e use SSH
git remote set-url origin git@github.com:username/repository.git
```
> 💡 **Pro Tip**: SSH keys mean say you no need dey enter password every time and dem dey more secure than old-fashioned authentication ways.
---
## Managing Your Code Like a Pro
Okay, THIS na where tins dey get really exciting! 🎉 We go learn how to track and manage your code like pros, and honestly, na one of my favorite tins to teach because e dey change how you work well well.
Imagine say you dey write amazing tori, and you want to keep track of every draft, every fine edit, and every "wait, na genius!" moment for di way. Na wetin Git dey do for your code! E be like say you get the best time-traveling notebook wey dey remember EVERYTHING every keystroke, every change, every "oops, I spoil tins" moment wey you fit instantly undo.
I go talk true e fit feel overwhelming at first. When I start, I think "Why I no fit just save my files like normal?" But trust me: when Git start make sense to you (e go!), you go get one of those lightbulb moments wey you go think "How I EVER dey code without am?" E be like you discover say you fit fly after you dey waka everywhere your whole life!
Make we say you get folder this side with some code project and you want start to track your progress with git - the version control system. Some people talk sey to use git na like write love letter to your future self. When you read your commit messages days/wks/months later, you go fit remember why you make decision, or "rollback" change dat mean if you write good "commit messages".
```mermaid
flowchart TD
A[📁 Your Project Files] --> B{Na Git Repository?}
B -->|No| C[git init]
B -->|Yes| D[Make Changes]
C --> D
D --> E[git add .]
E --> F["git commit -m 'message'"]
F --> G[git push]
G --> H[🌟 Code for GitHub!]
H --> I{You wan collaborate?}
I -->|Yes| J[Fork & Clone]
I -->|No| D
J --> K[Create Branch]
K --> L[Make Changes]
L --> M[Pull Request]
M --> N[🎉 Contributing!]
style A fill:#fff59d
style H fill:#c8e6c9
style N fill:#ff4081,color:#fff
```
### Task: Create Your First Repository!
> 🎯 **Your Mission (and I dey excited for you!)**: We go create your very first GitHub repository together! By the time we finish here, you go get your own little corner for internet wey your code dey live, and you go don make your first "commit" (na developer way to talk sey you save your work smart-smart).
>
> Dis na really special moment you dey ready to officially join di global developers community! I still remember di joy when I create my first repo and think "Wow, I really dey do dis!"
Make we waka through dis journey together, step by step. Take your time for each tin no be who rush go win, and I promise every step go clear. Remember, every coding superstar wey you dey look up to, dem once dey exactly where you dey, about to create their first repository. How beta na dat?
> Check video
>
> [![Git and GitHub basics video](https://img.youtube.com/vi/9R31OUPpxU4/0.jpg)](https://www.youtube.com/watch?v=9R31OUPpxU4)
**Make We Do Am Together:**
1. **Create your repository for GitHub**. Go GitHub.com and find dat bright green **New** button (or the **+** sign for top right). Click am and select **New repository**.
Here na wetin to do:
1. Give your repository name make am meaningful to you!
1. Add description if you want (dis help oda people understand what your project be)
1. Decide if you want am public (everybody fit see am) or private (na only you)
1. I recommend make you check box to add README file e be like project front page
1. Click **Create repository** and celebrate you don create your first repo! 🎉
2. **Go your project folder**. Now make we open your terminal (no worry, e no too scary). We need tell your computer where your project files dey. Type this command:
```bash
cd [name of your folder]
```
**Wetin we dey do here:**
- We dey basically tell computer "Hey, carry me go my project folder"
- E be like you open specific folder for desktop but we dey do am with text commands
- Change `[name of your folder]` to your actual project folder name
3. **Turn your folder to Git repository**. Na here the magic happen! Type:
```bash
git init
```
**Here na wetin just happen (cool stuff!):**
- Git just create hidden `.git` folder inside your project you no go see am but e dey
- Your normal folder don turn repository wey fit track every change you do
- Think am like you give folder superpowers to remember all tins
4. **Check wetin dey happen**. Make we see wetin Git dey talk about your project now:
```bash
git status
```
**Understand wetin Git dey talk:**
You fit see something like dis:
```output
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: file.txt
modified: file2.txt
```
**No panic! Dis na wetin e mean:**
- Files wey red mean say dem get changes but dem never ready to save yet
- Files wey green (if you see dem) mean dem ready for save
- Git dey help you by telling wetin you fit do next
> 💡 **Pro tip**: `git status` na your best friend! Use am anytime you no sabi wetin dey happen. Na like you dey ask Git "Hey, how tings be now?"
5. **Prepare your files to save** (dis na "staging"):
```bash
git add .
```
**Wetin we just do:**
- We tell Git "Hey, I want include ALL my files for next save"
- `.` mean "everything for this folder"
- Now your files dey staged and ready for next step
**You want more selective?** You fit add only specific files:
```bash
git add [file or folder name]
```
**Why you fit want do dis?**
- Sometimes you want group related changes
- E help you organize work in logical chunks
- Make am easy to understand what change and when
**Change your mind?** No wahala! You fit unstage files like dis:
```bash
# Comot everything from staging
git reset
# Comot only one file from staging
git reset [file name]
```
No worry dis no go delete your work, e just remove files from "ready to save" group.
6. **Save your work permanently** (make your first commit!):
```bash
git commit -m "first commit"
```
**🎉 Congratulations! You just make your first commit!**
**Here na wetin just happen:**
- Git take "snapshot" of all your staged files for this exact time
- Your commit message "first commit" explain wetin this save point mean
- Git give dis snapshot unique ID so you fit find am later
- You don officially start to track your project history!
> 💡 **Future commit messages**: For next commits, try dey more descriptive! Instead of "updated stuff", fit try "Add contact form to homepage" or "Fix navigation menu bug". Your future self go thank you!
7. **Connect your local project to GitHub**. Right now your project dey only for your computer. Make we connect am enter your GitHub repository so you fit share am with world!
First, go your GitHub repository page and copy the URL. Then come back here and type:
```bash
git remote add origin https://github.com/username/repository_name.git
```
(Replace dat URL with your actual repository URL!)
**Wetin we just do:**
- We create one connection between your local project and your GitHub repository
- "Origin" na just one nickname for your GitHub repository e be like if you add contact for your phone
- Now your local Git sabi where to send your code when you ready to share am
💡 **Easier way**: If you get GitHub CLI install, you fit do this for one command:
```bash
gh repo create my-repo --public --push --source=.
```
8. **Send your code go GitHub** (na the big moment!):
```bash
git push -u origin main
```
**🚀 Na so e be! You dey upload your code go GitHub!**
**Wetin dey happen:**
- Your commits dey travel from your computer go GitHub
- The `-u` flag dey set up permanent connection so future pushes go easier
- "main" na the name of your primary branch (like the main folder)
- After this, you fit just type `git push` for future uploads!
💡 **Quick note**: If your branch get different name (like "master"), use that name instead. You fit check am with `git branch --show-current`.
9. **Your new daily coding rhythm** (na here e go start to dey addictive!):
From now, anytime you make changes to your project, you get this simple three-step dance:
```bash
git add .
git commit -m "describe what you changed"
git push
```
**Na this your coding heartbeat go be:**
- Make some correct changes to your code ✨
- Stage dem with `git add` ("Hey Git, pay attention to these changes!")
- Save dem with `git commit` plus one descriptive message (future you go thank you!)
- Share dem with the world using `git push` 🚀
- Rinse and repeat no lie, e go become natural like to breathe!
I like this workflow because e be like say you get multiple save points for video game. You change wey you like? Commit am! You wan try something wey risk? No wahala you fit always go back to your last commit if thing spoil!
> 💡 **Tip**: You fit also want use `.gitignore` file to stop files wey you no want track from dey appear for GitHub - like that notes file wey you keep for the same folder but no need for public repository. You fit find templates for `.gitignore` files for [.gitignore templates](https://github.com/github/gitignore) or make your own using [gitignore.io](https://www.toptal.com/developers/gitignore).
### 🧠 **First Repository Check-in: How You Feel?**
**Take small time celebrate and think:**
- How e take feel to see your code show for GitHub the first time?
- Which step confuse you pass, and which no dey hard at all?
- You fit explain the difference between `git add`, `git commit`, and `git push` with your own words?
```mermaid
stateDiagram-v2
[*] --> LocalFiles: Create project
LocalFiles --> Staged: git add .
Staged --> Committed: git commit
Committed --> GitHub: git push
GitHub --> [*]: Success! 🎉
note right of Staged
Files don ready to save
end note
note right of Committed
Snapshot don create
end note
```
> **Remember**: Even experienced developers sef sometimes forget the correct commands. To make this workflow muscle memory need practice - you dey do well!
#### Modern Git workflows
Try adopt these modern ways:
- **Conventional Commits**: Use one standardized commit message format like `feat:`, `fix:`, `docs:`, and so on. Learn more for [conventionalcommits.org](https://www.conventionalcommits.org/)
- **Atomic commits**: Make each commit represent only one logical change
- **Frequent commits**: Commit often with good messages rather than large, rare commits
#### Commit messages
The correct Git commit subject line complete this sentence:
If apply am, this commit go <your subject line here>
For the subject, use imperative, present tense: "change" no be "changed" or "changes".
Even for the body (optional), use imperative, present tense. The body suppose include why you make the change and compare am with how e be before. You dey explain the `why`, no be the `how`.
✅ Take few minutes surf GitHub. Fit find one beta commit message? Fit find one wey short? Which kind info you think important pass to talk for commit message?
## Working with Others (The Fun Part!)
Hold your hat well because NA HERE GitHub go become magical! 🪄 You don master to manage your own code, but now we dey enter my favorite part to collaborate with good people from all countries.
Imagine say: tomorrow you wake up and see say person for Tokyo improve your code while you dey sleep. Then person for Berlin fix bug wey don jam you. By afternoon, developer for São Paulo don add one feature you never think of. That no be sci-fi na normal Tuesday for GitHub universe!
Wetin dey excite me be say the collaboration skills you go learn now? Na the very same workflows wey Google, Microsoft, and your favorite startups dey use every day. You no dey learn just cool tool you dey learn the secret language wey make the whole software world work together.
No joke, once you feel the rush wey person merge your first pull request, you go understand why developers like open source so much. E be like to dey part of the world biggest, most creative team project!
> Check the video
>
> [![Git and GitHub basics video](https://img.youtube.com/vi/bFCM-PC3cu8/0.jpg)](https://www.youtube.com/watch?v=bFCM-PC3cu8)
The main reason why we put things on GitHub na to make am possible to collaborate with other developers.
```mermaid
flowchart LR
A[🔍 Find Project] --> B[🍴 Fork Repository]
B --> C[📥 Clone to Local]
C --> D[🌿 Create Branch]
D --> E[✏️ Make Changes]
E --> F[💾 Commit Changes]
F --> G[📤 Push Branch]
G --> H[🔄 Create Pull Request]
H --> I{Maintainer Review}
I -->|✅ Approved| J[🎉 Merge!]
I -->|❓ Changes Requested| K[📝 Make Updates]
K --> F
J --> L[🧹 Clean Up Branches]
style A fill:#e3f2fd
style J fill:#e8f5e8
style L fill:#fff3e0
```
For your repository, go `Insights > Community` to see how your project take compare to recommended community standards.
You want make your repository look professional and welcoming? Go your repository and click on `Insights > Community`. This cool feature go show you how your project take match wetin GitHub community consider "good repository practices."
> 🎯 **Make Your Project Shine**: One well-organized repository with correct documentation na like one clean, welcoming storefront. E show say you dey serious about your work and e dey make others want to contribute!
**These na wetin make repository beta:**
| Wetin to Add | Why E Important | Wetin E Go Do For You |
|-------------|-----------------|-----------------------|
| **Description** | First impression dey important! | People go sabi quickly wetin your project dey do |
| **README** | Na your project's front page | Like friendly tour guide for new visitors |
| **Contributing Guidelines** | Show say you dey welcome help | People go understand how dem fit help you |
| **Code of Conduct** | Create friendly space | Everybody go feel welcome to participate |
| **License** | Legal clarity | Others go know how dem fit use your code |
| **Security Policy** | Show say you dey responsible | E dey show say you dey professional |
> 💡 **Pro Tip**: GitHub get templates for all these files. When you dey create new repository, check the boxes to generate these files automatically.
**Modern GitHub Features to Explore:**
🤖 **Automation & CI/CD:**
- **GitHub Actions** for automated testing and deployment
- **Dependabot** for automatic dependency updates
💬 **Community & Project Management:**
- **GitHub Discussions** for community conversations beyond issues
- **GitHub Projects** for kanban-style project management
- **Branch protection rules** to enforce code quality standards
All these things go help new team members settle well. And na these kind things new contributors dey check before dem even look your code, to find out if your project good place for their time.
✅ README files, even though dem take time to prepare, busy maintainers dey sometimes neglect dem. Fit find example of one wey descriptive well? Note: some [tools to help create good READMEs](https://www.makeareadme.com/) fit interest you.
### Task: Merge some code
Contributing docs dey help people contribute to project. E explain the kind contributions wey you want and how the process go be. Contributors go need do some steps before dem fit contribute for your repo on GitHub:
1. **Forking your repo** You probably want people to _fork_ your project. Forking mean say dem create replica of your repository on their GitHub profile.
1. **Clone**. Dem go clone the project to their local machine.
1. **Create a branch**. You want tell dem to create _branch_ for their work.
1. **Focus their change on one area**. Tell contributors to put contributions together one matter at a time - so the chance to _merge_ their work go high. Imagine say dem write bug fix, add new feature, and update plenty tests - what if you want or fit only add 2 from 3 or 1 from 3?
✅ Imagine situation where branches dey very important for writing and shipping good code. Which use cases you fit think of?
> Note, be the change you want for world, create branches for your own work too. Any commit you make go happen for branch wey you dey "checked out" to. Use `git status` to see which branch that be.
Make we go through contributor workflow. Assume say contributor don already _fork_ and _clone_ the repo so dem get Git repo to work on for their local machine:
1. **Create a branch**. Use command `git branch` to create branch wey go hold the changes dem wan contribute:
```bash
git branch [branch-name]
```
> 💡 **Modern Approach**: You fit also create and switch to new branch with one command:
```bash
git switch -c [branch-name]
```
1. **Switch to working branch**. Switch go the branch and update your working directory with `git switch`:
```bash
git switch [branch-name]
```
> 💡 **Modern Note**: `git switch` na the new way replace `git checkout` when changing branches. E clear and safer for beginners.
1. **Do work**. Now you wan add your changes. No forget tell Git about am with these commands:
```bash
git add .
git commit -m "my changes"
```
> ⚠️ **Commit Message Quality**: Make sure give your commit correct name, for your own sake and maintainer of repo wey you dey help. Be specific about wetin you change!
1. **Combine your work with the `main` branch**. When you finish work, you want combine your work with `main` branch. `main` branch fit don change meanwhile so first update am to latest with commands below:
```bash
git switch main
git pull
```
Now you want make sure say any _conflicts_, where Git no fit easily _combine_ changes, happen for your working branch. So run these commands:
```bash
git switch [branch_name]
git merge main
```
The `git merge main` command go bring all changes from `main` into your branch. Hope say you fit just continue. If no, VS Code go tell you where Git dey _confused_ so you go just change the files to show the correct content.
💡 **Modern alternative**: You fit try `git rebase` for cleaner history:
```bash
git rebase main
```
E replay your commits on top of the latest main branch, make history linear.
1. **Send your work to GitHub**. Sending work go GitHub mean two things. Push your branch to your repo and then open PR (Pull Request).
```bash
git push --set-upstream origin [branch-name]
```
The above command go create the branch on your forked repo.
### 🤝 **Collaboration Skills Check: Ready to Work with Others?**
**Make we see how you feel about collaboration:**
- You understand forking and pull requests now?
- Which one about working with branches you wan practice more?
- How you feel about contributing to person else project?
```mermaid
mindmap
root((Git Collaboration))
Branching
Feature branches
Bug fix branches
Experimental work
Pull Requests
Code review
Discussion
Testing
Best Practices
Clear commit messages
Small focused changes
Good documentation
```
> **Confidence booster**: Every single developer wey you admire bin nervous about their first pull request once. GitHub community dey very welcoming to newcomers!
1. **Open a PR**. Next, you want open PR. You do that by going your forked repo for GitHub. You go see one indication for GitHub wey go ask if you want create new PR, click am and you go reach interface wey you fit change commit message title and give better description. Now maintainer of the repo you forked go see this PR and _fingers crossed_ dem go appreciate and _merge_ your PR. You don become contributor, yay :)
💡 **Modern tip**: You fit also create PRs with GitHub CLI:
```bash
gh pr create --title "Your PR title" --body "Description of changes"
```
🔧 **Best practices for PRs**:
- Link related issues with keywords like "Fixes #123"
- Add screenshots for UI changes
- Request specific reviewers
- Use draft PRs for work-in-progress
- Make sure all CI checks pass before you ask for review
1. **Clean up**. E dey considered beta practice to _clean up_ afta you don merge PR well. You go wan clean up both your local branch and di branch wey you push go GitHub. First make we delete am for your local machine wit dis command:
```bash
git branch -d [branch-name]
```
Make sure say you go the GitHub page for di forked repo next and comot di remote branch wey you just push reach.
`Pull request` dey sound like joke but true talk be say you really wan push your changes go di project. But di maintainer (project owner) or core team need check your changes well before dem fit merge am with di project's "main" branch, so you really dey request say make maintainer decide about di change.
Pull request na di place wey you fit compare and discuss di differences wey dem add for one branch wit reviews, comments, integrated tests, and more. Beta pull request dey follow roughly di same rules like commit message. You fit add reference to one issue for di issue tracker, wen your work for example fix one issue. Dis one na by using `#` plus di number of your issue. Example be `#97`.
🤞Leg cross say all checks go pass and di project owner(s) go merge your changes to the project🤞
Update your current local working branch wit all new commits from di corresponding remote branch for GitHub:
`git pull`
## Contributing to Open Source (Your Chance to Make an Impact!)
You ready for somtin wey go for blow your mind fully? 🤯 Make we yan about how to contribute to open source projects and I dey get goosebumps just to think say I go share this with you!
Na your chance to become part of somtin wey really special. Imagine say you fit betta di tools wey millions of developers dey use everyday, or fix bug for app wey your friends like. Dis no be only dream na wetin open source contribution really mean!
Dis na wetin dey give me chills anytime I think am: every tool wey you don dey learn wit your code editor, di frameworks wey we go explore, even di browser wey you dey read dis one start from somebody like you wey make dem first contribution. Dat better developer wey build your favorite VS Code extension? Dem be once beginner too wey dey click "create pull request" wit shaking hand, just like you dey go do.
And di beta part be say: di open source community na like internet biggest group hug. Most projects dey find newcomers and get issues wey dem tag "good first issue" specially for people like you! Maintainers dey happy well well wen dem see new contributors because na dem dey remember their own first step.
```mermaid
flowchart TD
A[🔍 Explore GitHub] --> B[🏷️ Find "good first issue"]
B --> C[📖 Read Contributing Guidelines]
C --> D[🍴 Fork Repository]
D --> E[💻 Set Up Local Environment]
E --> F[🌿 Create Feature Branch]
F --> G[✨ Make Your Contribution]
G --> H[🧪 Test Your Changes]
H --> I[📝 Write Clear Commit]
I --> J[📤 Push & Create PR]
J --> K[💬 Engage with Feedback]
K --> L[🎉 Don merge! You be Contributor!]
L --> M[🌟 Find Another Issue]
style A fill:#e1f5fe
style L fill:#c8e6c9
style M fill:#fff59d
```
You no just dey learn how to code here you dey prepare to join worldwide family of builders wey dey wake up every day dey think "How we fit make digital world better small?" Welcome to di club! 🌟
First, make we find one repository (or **repo**) for GitHub wey you like and wey you want contribute change. You go wan copy di contents give your machine.
✅ Better way to find 'beginner-friendly' repos na to [search by di tag 'good-first-issue'](https://github.blog/2020-01-22-browse-good-first-issues-to-start-contributing-to-open-source/).
![Copy a repo locally](../../../../translated_images/clone_repo.5085c48d666ead57.pcm.png)
Plenti way dey to copy code. One way na to "clone" di contents of di repository, using HTTPS, SSH, or GitHub CLI (Command Line Interface).
Open your terminal make you clone the repository like dis:
```bash
# Dey use HTTPS
git clone https://github.com/ProjectURL
# Dey use SSH (need SSH key setup)
git clone git@github.com:username/repository.git
# Dey use GitHub CLI
gh repo clone username/repository
```
To work on di project, switch go di right folder:
`cd ProjectURL`
You fit also open di whole project using:
- **[GitHub Codespaces](https://github.com/features/codespaces)** - GitHub cloud development environment with VS Code for browser
- **[GitHub Desktop](https://desktop.github.com/)** - GUI app for Git operations
- **[GitHub.dev](https://github.dev)** - Press `.` key for any GitHub repo to open VS Code in browser
- **VS Code** wit GitHub Pull Requests extension
Finally, you fit download di code inside zipped folder.
### Small tin dem about GitHub wey interesting
You fit star, watch and/or "fork" any public repository for GitHub. You fit find your starred repositories for di top-right drop-down menu. Na like bookmarking but na for code.
Projects get issue tracker, mostly for GitHub for "Issues" tab unless dem talk otherwise, where people dey discuss issues wey concern di project. And Pull Requests tab na where people dey discuss and review changes wey dey progress.
Projects fit also get discussions for forums, mailing lists, or chat channels like Slack, Discord or IRC.
🔧 **Modern GitHub features**:
- **GitHub Discussions** - Inside forum for community talk
- **GitHub Sponsors** - Support maintainers with money
- **Security tab** - Make vulnerability reports and security advisories available
- **Actions tab** - See automated workflows and CI/CD pipelines
- **Insights tab** - Analytics about contributors, commits, and health of project
- **Projects tab** - GitHub built-in project management tools
✅ Make you look your new GitHub repo well well and try few tings, like edit settings, add info for your repo, create project (like Kanban board), and set GitHub Actions for automation. Plenty tins you fit do!
---
## 🚀 Challenge
Okay, na time to test your new GitHub powers! 🚀 Here be challenge wey go make everything clear in one sweet way:
Carry your friend (or dat family member wey always dey ask wetin you dey do with all dis "computer stuff") come do collaborative coding adventure together! Na dis one be where real magic dey happen create project, mek dem fork am, make branches, and merge changes like pros wey you dey become.
I no go lie you go laugh for some moment (especially wen una both dey try change di same line), maybe scratch your head in confusion, but you go get all those "aha!" moments wey make all di learning worth am. Plus, something special dey for sharing dat first successful merge wit another person na small celebration of how far you don waka!
No get coding buddy yet? No wahala at all! GitHub community full with people wey dey super welcoming and remember how e be to dey new. Find repositories with "good first issue" labels dem dey basically yan "Hey beginners, come learn with us!" How cool be that?
## Post-Lecture Quiz
[Post-lecture quiz](https://ff-quizzes.netlify.app/web/en/)
## Review & Keep Learning
Whew! 🎉 Look you you don conquer GitHub basics like champion! If your brain feel kinda full now, no worry, e normal and na good sign. You don learn tools wey e take me weeks to feel comfortable with when I start.
Git and GitHub powerful well well (like, seriously powerful), and every developer wey I sabi even those wey be like wizards now dem bin need practice and stumble small before e make sense. The fact say you don pass this lesson mean say you dey on your way to sabi some of di most important tools for developer toolkit.
Here some plenty beta resources to help you practice and become even more better:
- [Contributing to open source software guide](https://opensource.guide/how-to-contribute/#how-to-submit-a-contribution) Your roadmap to make difference
- [Git cheatsheet](https://training.github.com/downloads/github-git-cheat-sheet/) Keep am handy for quick reference!
And remember: practice dey make progress, no be perfection! Di more you use Git and GitHub, di more e go dey natural. GitHub don create beta interactive courses wey go let you practice for safe environment:
- [Introduction to GitHub](https://github.com/skills/introduction-to-github)
- [Communicate using Markdown](https://github.com/skills/communicate-using-markdown)
- [GitHub Pages](https://github.com/skills/github-pages)
- [Managing merge conflicts](https://github.com/skills/resolve-merge-conflicts)
**Feel like adventure? Check out dis modern tools:**
- [GitHub CLI documentation](https://cli.github.com/manual/) If you wan feel like command-line wizard
- [GitHub Codespaces documentation](https://docs.github.com/en/codespaces) Code for cloud!
- [GitHub Actions documentation](https://docs.github.com/en/actions) Automate all tings
- [Git best practices](https://www.atlassian.com/git/tutorials/comparing-workflows) Level up your workflow game
## GitHub Copilot Agent Challenge 🚀
Use Agent mode to complete dis challenge:
**Description:** Create collaborative web development project wey show di complete GitHub workflow wey you don learn for dis lesson. Dis challenge go help you practice repository creation, collaboration features, and modern Git workflows inside real-world scenario.
**Prompt:** Create new public GitHub repository for simple "Web Development Resources" project. Di repository suppose get well-structured README.md file wey dey list beta web development tools and resources, organized by categories (HTML, CSS, JavaScript, etc.). Set up di repository wit proper community standards including license, contributing guidelines, and code of conduct. Create at least two feature branches: one for adding CSS resources and another one for JavaScript resources. Make commits for each branch wit descriptive commit messages, then create pull requests make e merge changes back go main. Enable GitHub features like Issues, Discussions, and setup basic GitHub Actions workflow for automated checks.
## Assignment
Your mission, if you choose accept am: Complete [Introduction to GitHub](https://github.com/skills/introduction-to-github) course for GitHub Skills. Dis interactive course go allow you practice everything wey you learn for safe, guided environment. Plus, you go collect beta badge when you finish! 🏅
**Feel ready for more challenges?**
- Set up SSH authentication for your GitHub account (no password again!)
- Try use GitHub CLI for your daily Git operations
- Create repository with GitHub Actions workflow
- Explore GitHub Codespaces by opening dis same repository in cloud-based editor
---
## 🚀 Your GitHub Mastery Timeline
### ⚡ **Wetin You Fit Do Next 5 Minutes**
- [ ] Star dis repository and 3 other projects wey interest you
- [ ] Set up two-factor authentication for your GitHub account
- [ ] Create simple README for your first repository
- [ ] Follow 5 developers wey their work inspire you
### 🎯 **Wetin You Fit Accomplish This Hour**
- [ ] Complete post-lesson quiz and reflect on your GitHub journey
- [ ] Set up SSH keys for password-free GitHub authentication
- [ ] Create your first meaningful commit wit beta commit message
- [ ] Explore GitHub "Explore" tab to discover trending projects
- [ ] Practice forking repository and make small changes
### 📅 **Your Week-Long GitHub Adventure**
- [ ] Complete GitHub Skills courses (Introduction to GitHub, Markdown)
- [ ] Make your first pull request to open source project
- [ ] Set up GitHub Pages site to showcase your work
- [ ] Join GitHub Discussions on projects wey you dey interested for
- [ ] Create repository wit proper community standards (README, License, etc.)
- [ ] Try GitHub Codespaces for cloud-based development
### 🌟 **Your Month-Long Transformation**
- [ ] Contribute to 3 different open source projects
- [ ] Mentor new person for GitHub (pay am forward!)
- [ ] Set up automated workflows wit GitHub Actions
- [ ] Build portfolio wey showcase your GitHub contributions
- [ ] Participate for Hacktoberfest or similar community events
- [ ] Become maintainer for your own project wey others go contribute to
### 🎓 **Final GitHub Mastery Check-in**
**Celebrate how far you don waka:**
- Wetin be your favorite thing about using GitHub?
- Which collaboration feature dey excite you pass?
- How confident you dey feel about contributing to open source now?
- Wetin be di first project wey you want contribute to?
```mermaid
journey
title Your GitHub Confidence Journey
section Today
Nervous: 3: You
Curious: 4: You
Excited: 5: You
section This Week
Practicing: 4: You
Contributing: 5: You
Connecting: 5: You
section Next Month
Collaborating: 5: You
Leading: 5: You
Inspiring Others: 5: You
```
> 🌍 **Welcome to global developer community!** Now you get di tools to collaborate wit millions of developers worldwide. Your first contribution fit look small, but remember - every big open source project start wit somebody making their first commit. Di question no be if you go make impact, but wetin beta project go benefit from your unique perspective first! 🚀
Remember: every expert na once beginner. You get am! 💪
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document don translate wit AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator). Even though we dey try make everything correct, abeg sabi say automated translation fit get mistakes or no too accurate. Di original document wey dey im own language na di correct one wey you suppose trust. If na important matter, e good make professional human translator do am. We no go take responsibility if person no understand well or misinterpret because of this translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,261 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "e6d0f456dfc22afb41bbdefeb5ec179d",
"translation_date": "2026-01-08T19:49:09+00:00",
"source_file": "1-getting-started-lessons/3-accessibility/assignment.md",
"language_code": "pcm"
}
-->
# Comprehensive Website Accessibility Audit
## Instructions
For dis assignment, you go carry out professional level accessibility audit for real website, apply the principles and techniques wey you don learn. Dis hands-on experience go deepen your understanding of accessibility barriers and solutions.
Choose website wey get accessibility issues—dis one go give you more learning chance than to analyze website wey don perfect already. Good options na old websites, complex web applications, or sites wey get plenty multimedia content.
### Phase 1: Strategic manual evaluation
Before you start to use automated tools, do thorough manual assessment first. Dis human-centered way dey show issues wey tools fit miss and e go help you understand how real users dey experience am.
**🔍 Important evaluation criteria:**
**Navigation and Structure:**
- You fit navigate whole site use keyboard only (Tab, Shift+Tab, Enter, Space, Arrow keys)?
- Focus indicators dey clear for all interactive elements?
- Heading structure (H1-H6) dey create logical content outline?
- E get skip links to jump go main content?
**Visual Accessibility:**
- Color contrast everywhere for site dey enough (minimum 4.5:1 for normal text)?
- Site dey use only color to show important information?
- All images get correct alternative text?
- Layout still dey functional when you zoom to 200%?
**Content and Communication:**
- E get "click here" or unclear link texts?
- You fit understand content and how e work without visual aid?
- Form fields properly labeled and grouped?
- Error messages clear and helpful?
**Interactive Elements:**
- All buttons and form controls dey work with keyboard alone?
- Dynamic content changes dey announce to screen readers?
- Modal dialogs and complex widgets dey follow proper accessibility patterns?
📝 **Write down your findings** with example them, screenshots, and page URLs. Mention both issues and good things.
### Phase 2: Comprehensive automated testing
Now, check and expand your manual findings with top-level accessibility testing tools. Each tool get different strength, so use multiple tools to cover everything.
**🛠️ Testing tools wey you go need:**
1. **Lighthouse Accessibility Audit** (inside Chrome/Edge DevTools)
- Run audit for multiple pages
- Focus on certain metrics and tips
- Note your accessibility score and issues
2. **axe DevTools** (browser extension - industry standard)
- More detailed issue detection than Lighthouse
- Give specific code examples for fixes
- Test against WCAG 2.1 standards
3. **WAVE Web Accessibility Evaluator** (browser extension)
- Visual display of accessibility features
- Highlights errors and positive features
- Good for understanding page structure
4. **Color Contrast Analyzers**
- WebAIM Contrast Checker for specific color pairs
- Browser extensions for whole page analysis
- Test against WCAG AA and AAA standards
**🎧 Real assistive technology testing:**
- **Screen reader testing**: Use NVDA (Windows), VoiceOver (Mac), or TalkBack (Android)
- **Keyboard-only navigation**: Unplug mouse, navigate whole site with keyboard only
- **Zoom testing**: Test for 200% and 400% zoom levels
- **Voice control testing**: If available, try voice navigation tools
**📊 Organize your results** by creating big spreadsheet with:
- Issue description and place
- Severity level (Critical/High/Medium/Low)
- WCAG criteria wey get problem
- Tool wey find issue
- Screenshots and proofs
### Phase 3: Comprehensive findings documentation
Make professional accessibility audit report wey show say you understand technical issues and how e affect people.
**📋 Report sections wey you need:**
1. **Executive Summary** (1 page)
- Website URL and short description
- Overall accessibility level
- Top 3 most important issues
- Estimated effect for users wey get disabilities
2. **Methodology** (½ page)
- Testing approach and tools wey you use
- Pages checked and device/browser used
- Standards checked against (WCAG 2.1 AA)
3. **Detailed Findings** (2-3 pages)
- Issues grouped by WCAG principle (Perceivable, Operable, Understandable, Robust)
- Add screenshots and specific examples
- Note positive accessibility features you find
- Cross-check with automated tool results
4. **User Impact Assessment** (1 page)
- How your issues affect users with different disabilities
- Scenarios wey talk about real user experience
- Business impact (legal risk, SEO, user growth)
**📸 Evidence collection:**
- Screenshots of violations
- Screen recordings of problem user flows
- Tool reports (save as PDFs)
- Code examples of issues
### Phase 4: Professional remediation plan
Make strategic, prioritized plan to fix accessibility problems. Dis one go show say you sabi think like professional web developer wey dey solve real business wahala.
**🎯 Create detailed improvement recommendations (minimum 10 issues):**
**For each issue, provide:**
- **Issue Description**: Clear talk wetin wrong and why e be problem
- **WCAG Reference**: Specific criteria wey you break (e.g., "2.4.4 Link Purpose (In Context) - Level A")
- **User Impact**: How e affect people with different disabilities
- **Solution**: Specific code change, design change, or process fix
- **Priority Level**: Critical (blocks basic use) / High (big barrier) / Medium (usability problem) / Low (improvement)
- **Implementation Effort**: Time or complexity estimate (Quick win / Moderate effort / Major refactor)
- **Testing Verification**: How to check say the fix dey work
**Example improvement entry:**
```
Issue: Generic "Read more" link text appears 8 times on homepage
WCAG Reference: 2.4.4 Link Purpose (In Context) - Level A
User Impact: Screen reader users cannot distinguish between links when viewed in link list
Solution: Replace with descriptive text like "Read more about sustainability initiatives"
Priority: High (major navigation barrier)
Effort: Low (30 minutes to update content)
Testing: Generate link list with screen reader - each link should be meaningful standalone
```
**📈 Strategic implementation phases:**
- **Phase 1 (0-2 weeks)**: Critical issues wey block basic function
- **Phase 2 (1-2 months)**: High priority improvements for better user experience
- **Phase 3 (3-6 months)**: Medium priority enhancements and process improvements
- **Phase 4 (Ongoing)**: Continuous monitoring and enhancement
## Evaluation Rubric
Your accessibility audit go get rating for both technical correctness and professional presentation:
| Criteria | Excellent (90-100%) | Good (80-89%) | Satisfactory (70-79%) | Needs Improvement (<70%) |
|----------|-------------------|---------------|---------------------|------------------------|
| **Manual Testing Depth** | Deep evaluation covering all POUR principles with detailed notes and user examples | Good coverage for most accessibility areas with clear findings and some user impact | Basic evaluation covering important areas with enough notes | Limited testing with shallow notes and little user impact thought |
| **Tool Utilization & Analysis** | Uses all required tools well, cross-checks findings, includes proof, analyzes tool limits | Uses most tools well with good notes, some cross-checking, and enough proof | Uses required tools with basic notes and some proof | Small tool use, poor notes, or missing proof |
| **Issue Identification & Categorization** | Finds 15+ specific issues for all WCAG principles, correctly categorizes by severity, shows deep understanding | Finds 10-14 issues across most WCAG principles, good categorization, solid understanding | Finds 7-9 issues with enough WCAG coverage and basic category work | Finds less than 7 issues with limited scope or poor categorization |
| **Solution Quality & Feasibility** | 10+ detailed and actionable solutions with exact WCAG references, real implementation timelines, and verification | 8-9 well-made solutions with mostly exact references and good implementation plans | 6-7 basic solutions with some detail and mostly real plans | Less than 6 solutions or missing detail, unrealistic plans |
| **Professional Communication** | Report well organized, clear, includes executive summary, uses proper technical language, business style | Good organization with good writing, includes most required sections, proper tone | Okay organization with acceptable writing, basic required sections | Bad organization, unclear writing, or missing main sections |
| **Real-World Application** | Shows understanding of business impact, legal stuff, user variety, real implementation challenges | Shows good understanding of practical use with some business context | Basic understanding of real-world use | Little connection to practical use |
## Advanced Challenge Options
**🚀 For students wey want extra challenge:**
- **Comparative Analysis**: Audit 2-3 competing websites and compare their accessibility levels
- **Mobile Accessibility Focus**: Deep check mobile-specific accessibility issues using Android TalkBack or iOS VoiceOver
- **International Perspective**: Research and apply accessibility standards from different countries (EN 301 549, Section 508, ADA)
- **Accessibility Statement Review**: Check website existing accessibility statement (if any) against your findings
## Deliverables
Submit professional accessibility audit report wey show your top-level analysis and practical plan:
**📄 Final Report Requirements:**
1. **Executive Summary** (1 page)
- Website overview and accessibility level assessment
- Key findings summary with business impact
- Recommended priority actions
2. **Methodology and Scope** (1 page)
- Testing approach, tools used, and evaluation criteria
- Pages/sections evaluated and any limits
- Standards compliance framework (WCAG 2.1 AA)
3. **Detailed Findings Report** (3-4 pages)
- Manual testing notes with user examples
- Automated tool results with cross-checking
- Issues grouped by WCAG principles with proof
- Positive accessibility features found
4. **Strategic Remediation Plan** (3-4 pages)
- Prioritized improvement recommendations (minimum 10)
- Implementation timeline with effort estimates
- Success metrics and verification ways
- Long term accessibility maintenance plan
5. **Supporting Evidence** (Appendices)
- Screenshots of accessibility breaks and testing tools
- Code examples showing issues and fixes
- Tool reports and audit summaries
- Screen reader testing notes or recordings
**📊 Format Requirements:**
- **Document format**: PDF (professional look)
- **Word count**: 2,500-3,500 words (no counting appendices or screenshots)
- **Visual elements**: Add screenshots, diagrams, and examples everywhere
- **Citations**: Show WCAG guidelines and accessibility resources properly
**💡 Pro Tips for Excellence:**
- Use professional report formatting with consistent headings and style
- Add table of contents for easy navigation
- Balance technical correctness with clear, business-appropriate language
- Show understanding of both technical work and user impact
## Learning Outcomes
After finishing dis comprehensive accessibility audit, you go gain important professional skills:
**🎯 Technical Competencies:**
- **Accessibility Testing Mastery**: Pro skill with manual and automated testing methods wey industry uses
- **WCAG Application**: Real experience applying Web Content Accessibility Guidelines for real situations
- **Assistive Technology Understanding**: Hands-on with screen readers and keyboard navigation
- **Problem-Solution Mapping**: Fit identify accessibility barriers and develop specific, actionable fix plans
**💼 Professional Skills:**
- **Technical Communication**: Experience writing professional accessibility reports for different stakeholders
- **Strategic Planning**: Fit prioritize accessibility improvements based on user impact and implementation ease
- **Quality Assurance**: Understand accessibility testing as part of development lifecycle
- **Risk Assessment**: Appreciation of legal, business, and ethical sides of accessibility compliance
**🌍 Inclusive Design Mindset:**
- **User Empathy**: Deep understanding of different user needs and assistive technology interaction
- **Universal Design Principles**: Know say accessible design benefits all users, no be only people wey get disabilities
- **Continuous Improvement**: Framework for ongoing accessibility check and enhancement
- **Advocacy Skills**: Confidence to promote accessibility best practice for future projects and team
**🚀 Career Preparation:**
Dis assignment na like real-world accessibility consulting project, e go give you portfolio-worthy experience wey show:
- Systematic problem-solving approach
- Attention to both technical details and business impact
- Clear communication of complex technical things
- Understanding of legal and ethical responsibilities for web development
Once you finish am, you go ready to sabi contribute wella to accessibility work inside any web development role and champion inclusive design practice for your career.
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document don translate wit AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator). Even though we try make everything correct, abeg sabi say automated translations fit get error or wahala. Di original document for im own language na di correct one wey you suppose trust. If na important matter, e better make human expert translate am. We no go take responsibility if person no understand or if person use dis translation wrong.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,33 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "770d9f83dddc841c19f210dee5fe0712",
"translation_date": "2026-01-08T11:39:49+00:00",
"source_file": "1-getting-started-lessons/README.md",
"language_code": "pcm"
}
-->
# How to Start with Web Development
For dis section of di curriculum, we go introduce you to non project-based tins wey important to become professional developer.
### Topics
1. [Introduction to Programming Languages and Tools of the Trade](1-intro-to-programming-languages/README.md)
2. [Introduction to GitHub](2-github-basics/README.md)
3. [Basics of Accessibility](3-accessibility/README.md)
### Credits
Introduction to Programming Languages and Tools of the Trade na wetin [Jasmine Greenaway](https://twitter.com/paladique) write with ♥️
Introduction to GitHub na wetin [Floor Drees](https://twitter.com/floordrees) write with ♥️
Basics of Accessibility na wetin [Christopher Harrison](https://twitter.com/geektrainer) write with ♥️
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis documento don translate wit AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator). Even though we try make am correct, abeg sabi say automated translation fit get small mistake or wahala. Di original document wey dey im own language na im be di correct one to trust. For important mata, better make person wey sabi dey translate am humanly. We no go responsible if pesin no understand well or if mistake show for dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

File diff suppressed because it is too large Load Diff

@ -0,0 +1,618 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "672b0bb6e8b431075f3bdb7130590d2d",
"translation_date": "2026-01-08T12:31:40+00:00",
"source_file": "2-js-basics/1-data-types/README.md",
"language_code": "pcm"
}
-->
# JavaScript Basics: Data Types
![JavaScript Basics - Data types](../../../../translated_images/webdev101-js-datatypes.4cc470179730702c.pcm.png)
> Sketchnote by [Tomomi Imura](https://twitter.com/girlie_mac)
```mermaid
journey
title Your JavaScript Data Types Adventure
section Foundation
Variables & Constants: 5: You
Declaration Syntax: 4: You
Assignment Concepts: 5: You
section Core Types
Numbers & Math: 4: You
Strings & Text: 5: You
Booleans & Logic: 4: You
section Apply Knowledge
Type Conversion: 4: You
Real-world Examples: 5: You
Best Practices: 5: You
```
Data types na one of di basic concepts for JavaScript wey you go see for every program wey you go write. Make you think data types like di filing system wey old librarians for Alexandria use dem get special places for scrolls wey dey hold poetry, mathematics, and historical records. JavaScript organize information like that but e get different categories for different kain data.
For dis lesson, we go explore di main data types wey dey make JavaScript work. You go learn how to handle numbers, text, true/false values, and sabi why e good to pick correct type for your programs. Dis ideas fit look like say dem hard first, but as you dey practice, e go become easy.
To sabi data types go make everything for JavaScript clear. Like how architects need to sabi different building materials before dem go build big church, these basics go support everything you go build later.
## Pre-Lecture Quiz
[Pre-lecture quiz](https://ff-quizzes.netlify.app/web/)
Dis lesson cover basics of JavaScript, di language wey dey give interactivity for web.
> You fit do dis lesson for [Microsoft Learn](https://docs.microsoft.com/learn/modules/web-development-101-variables/?WT.mc_id=academic-77807-sagibbon)!
[![Variables](https://img.youtube.com/vi/JNIXfGiDWM8/0.jpg)](https://youtube.com/watch?v=JNIXfGiDWM8 "Variables in JavaScript")
[![Data Types in JavaScript](https://img.youtube.com/vi/AWfA95eLdq8/0.jpg)](https://youtube.com/watch?v=AWfA95eLdq8 "Data Types in JavaScript")
> 🎥 Click di pictures wey dey over for videos about variables and data types
Make we start with variables and di data types wey dem dey carry!
```mermaid
mindmap
root((JavaScript Data))
Variables
let myVar
const PI = 3.14
var oldStyle
Primitive Types
number
42
3.14
-5
string
"Hello"
'World'
`Template`
boolean
true
false
undefined
null
Operations
Arithmetic
+ - * / %
String Methods
concatenation
template literals
Type Conversion
implicit
explicit
```
## Variables
Variables na di basic building blocks for programming. Like di labeled jars wey old alchemists for middle age use to store different tins, variables dey let you store information and give am name wey make sense so you fit use am later. You want remember person age? Store am for variable wey dem call `age`. You want track user name? Put am for variable wey dem call `userName`.
We go focus on di modern way to create variables for JavaScript. Di ways wey you go learn here na beta practices and years wey language don take improve.
To create and **declare** variable get dis syntax: **[keyword] [name]**. E get two parts:
- **Keyword**. Use `let` for variables wey fit change, or `const` for values wey no gree change.
- **The variable name**, dis na the descriptive name you go choose.
✅ Di keyword `let` come from ES6 and e give your variable so called _block scope_. Dem recommend say make you use `let` or `const` instead of di old `var` keyword. We go talk more about block scopes for later parts.
### Task - working with variables
1. **Declare a variable**. Make we start by creating our first variable:
```javascript
let myVariable;
```
**Wetin dis one dey do:**
- E tell JavaScript say make e create storage place wey dem call `myVariable`
- JavaScript go allocate space for dis variable for memory
- Di variable no get value yet (undefined)
2. **Give am value**. Now make we put somtin inside our variable:
```javascript
myVariable = 123;
```
**How assignment dey work:**
- Di `=` operator assign di value 123 to our variable
- Di variable now get dis value, no be undefined again
- You fit call dis value anywhere for your code using `myVariable`
> Note: di use of `=` for dis lesson mean say we dey use "assignment operator", wey dem dey use put value for variable. E no mean equality.
3. **Do am di smart way**. Actually, make we combine di two steps:
```javascript
let myVariable = 123;
```
**Dis approach dey more efficient:**
- You dey declare variable and assign value inside one statement
- Na standard practice wey developers dey use
- E reduce length of code but still clear
4. **Change your mind**. Wetin if we want store another number?
```javascript
myVariable = 321;
```
**Understanding reassignment:**
- Di variable now get 321 instead of 123
- Di old value don commot variables fit store only one value at once
- Dis mutability na di main feature of variables wey dem declare with `let`
✅ Try am! You fit write JavaScript for your browser. Open browser window go Developer Tools. For console, you go see prompt; type `let myVariable = 123`, press enter, then type `myVariable`. Wetin go happen? Note say you go learn more about dis matter for lessons wey go follow.
### 🧠 **Variables Mastery Check: Getting Comfortable**
**Make we check how you dey understand variables:**
- You fit explain difference between declaring and assigning variable?
- Wetin go happen if you try use variable before you declare am?
- When you go choose `let` over `const` for variable?
```mermaid
stateDiagram-v2
[*] --> Declared: let myVar
Declared --> Assigned: myVar = 123
Assigned --> Reassigned: myVar = 456
Assigned --> [*]: Variable ready!
Reassigned --> [*]: Updated value
note right of Declared
Variable dey but
e no get value (undefined)
end note
note right of Assigned
Variable get
di value 123
end note
```
> **Quick tip**: Think of variables like labeled storage boxes. You create di box (`let`), put somtin inside (`=`), and fit change di content later if you want!
## Constants
Sometimes you need store information wey no suppose change at all while program dey run. Think of constants like mathematical rules Euclid establish for ancient Greece once dem prove am and write am down, e no change again for future.
Constants dey work almost like variables, but with big restriction: once you assign value, you no fit change am. Dis immutability dey prevent you from making mistake wey fit change important values inside your program.
To declare and initialize constant get same idea like variable, but you go use `const` keyword. Constants dey usually declared with all uppercase letters.
```javascript
const MY_VARIABLE = 123;
```
**Wetin dis code dey do:**
- **Create** constant wey dem name `MY_VARIABLE` get value 123
- **Use** uppercase letters for constant names
- **No gree** make anybody change dis value later
Constants get two big rules:
- **You must assign dem value immediately** no empty constant dey allowed!
- **You no fit change dat value** JavaScript go throw error if you try. Make we see wetin I mean:
**Simple value** - This one na NO NO:
```javascript
const PI = 3;
PI = 4; // no gree
```
**Wet wey you must remember:**
- **Try to reassign constant dey cause error**
- **E protect important values from wrong change**
- **E make sure di value remain same for whole your program**
**Object reference protected** - Dis one NO NO:
```javascript
const obj = { a: 3 };
obj = { b: 5 } // no gree
```
**Wetin dis mean:**
- **E no gree make you replace whole object with new one**
- **E protect di reference to original object**
- **E maintain di object's identity inside memory**
**Object value no protected** - Dis one DEY ALLOW:
```javascript
const obj = { a: 3 };
obj.a = 5; // e dey allowed
```
**Wetin dey happen here:**
- **E dey modify di property inside di object**
- **E dey keep di same object reference**
- **E show say object contents fit change even if reference no change**
> Note, `const` mean say di reference protect from reassignment. But di value no _immutable_ as e fit change, especially if na complex construct like object.
## Data Types
JavaScript organize information into different groups wey we dey call data types. Dis concept like how old scholars classify knowledge Aristotle separate types of reasoning, sabi say logical principles no fit work same way for poetry, mathematics, and natural philosophy.
Data types matter because different operations dey work with different kind information. Like you no fit do number maths on person name, or arrange alphabet for mathematical formula, JavaScript need correct data type for each operation. To sabi dis go prevent errors and make your code better.
Variables fit hold many different kind values like numbers and text. These different kinds na di **data type**. Data types matter for software development because e help developers decide how code suppose be written and how software suppose run. Some data types get special features wey dey help to transform or get extra info from value.
✅ Data Types still dey call JavaScript data primitives, because dem be di lowest-level data types wey language provide. E get 7 primitive data types: string, number, bigint, boolean, undefined, null, and symbol. Take small time make you imagine wetin each of these primitives fit mean. Wetin be `zebra`? How about `0`? `true`?
### Numbers
Numbers na di most straightforward data type for JavaScript. Whether you dey work with whole numbers like 42, decimals like 3.14, or negative numbers like -5, JavaScript treat dem all the same.
Remember our variable from earlier? That 123 we put na number data type:
```javascript
let myVariable = 123;
```
**Key characteristics:**
- JavaScript automatically sabi numeric values
- You fit do mathematical operations with these variables
- No need to tell type explicitly
Variables fit hold all types number including decimals or negative numbers. Numbers fit also use with arithmetic operators, wey we go talk later for [next section](../../../../2-js-basics/1-data-types).
```mermaid
flowchart LR
A["🔢 Numbers"] --> B[" Add"]
A --> C[" Subtract"]
A --> D["✖️ Multiply"]
A --> E["➗ Divide"]
A --> F["📊 Remainder %"]
B --> B1["1 + 2 = 3"]
C --> C1["5 - 3 = 2"]
D --> D1["4 * 3 = 12"]
E --> E1["10 / 2 = 5"]
F --> F1["7 % 3 = 1"]
style A fill:#e3f2fd
style B fill:#e8f5e8
style C fill:#fff3e0
style D fill:#f3e5f5
style E fill:#e0f2f1
style F fill:#fce4ec
```
### Arithmetic Operators
Arithmetic operators na operators wey let you do maths calculations for JavaScript. These operators follow same rules wey mathematicians don dey use for centuries same symbols wey scholars like Al-Khwarizmi use for algebra.
Operators dey work like normal maths: plus for add, minus for subtract and so on.
E get plenty operators for arithmetic functions, some of dem be:
| Symbol | Description | Example |
| ------ | ------------------------------------------------------------------------ | -------------------------------- |
| `+` | **Addition**: Calculate sum of two numbers | `1 + 2 //expected answer be 3` |
| `-` | **Subtraction**: Calculate difference of two numbers | `1 - 2 //expected answer be -1` |
| `*` | **Multiplication**: Calculate product of two numbers | `1 * 2 //expected answer be 2` |
| `/` | **Division**: Calculate quotient of two numbers | `1 / 2 //expected answer be 0.5` |
| `%` | **Remainder**: Calculate remainder from division of two numbers | `1 % 2 //expected answer be 1` |
✅ Try am! Try do arithmetic operation for your browser console. Di result go shock you?
### 🧮 **Math Skills Check: Calculating with Confidence**
**Test your arithmetic skills:**
- Wetin be difference between `/` (division) and `%` (remainder)?
- Can you predict wetin `10 % 3` go be? (Hint: e no be 3.33...)
- Why remainder operator dey useful for programming?
```mermaid
pie title "JavaScript Number Operations Usage"
"Addition (+)" : 35
"Subtraction (-)" : 20
"Multiplication (*)" : 20
"Division (/)" : 15
"Remainder (%)" : 10
```
> **Real-world insight**: Remainder operator (%) dey very useful to check if number be even or odd, create patterns, or move through arrays!
### Strings
For JavaScript, text data na strings. Di word "string" mean characters wey dem join one after another, like how scribes for old monasteries put letters together to form words and sentences.
Strings na very important for web development. Every piece of text for website usernames, buttons, error messages, content all na string. To understand strings dey important if you want build functional user interfaces.
Strings na set of characters wey dem put for single or double quotes.
```javascript
'This is a string'
"This is also a string"
let myString = 'This is a string value stored in a variable';
```
**Understanding dis concepts:**
- **Uses** either single quotes `'` or double quotes `"` to mark strings
- **Stores** text data wey fit contain letters, numbers, symbols
- **Assigns** string values to variables to use later
- **Need** quotes to show say na text, no be variable name
Remember to use quotes when you dey write string, otherwise JavaScript go think say na variable name.
```mermaid
flowchart TD
A["📝 Strings"] --> B["Single Quotes"]
A --> C["Double Quotes"]
A --> D["Template Literals"]
B --> B1["'Hello World'"]
C --> C1["\"Hello World\""]
D --> D1["`Hello \${name}`"]
E["String Palava Dem"] --> F["Join Dem Together"]
E --> G["Put Template Inside"]
E --> H["Length & Methods"]
F --> F1["'Hello' + ' ' + 'World'"]
G --> G1["`Hello \${firstName} \${lastName}`"]
H --> H1["myString.length"]
style A fill:#e3f2fd
style E fill:#fff3e0
style D fill:#e8f5e8
style G fill:#e8f5e8
```
### Formatting Strings
String manipulation dey allow you join text, put variables inside text, and create dynamic content wey fit change as program dey run. Dis technique dey help you build text with code.
Sometimes you need to join many strings together dis process na concatenation.
To **join** two or more strings together, or put dem join, use the `+` operator.
```javascript
let myString1 = "Hello";
let myString2 = "World";
myString1 + myString2 + "!"; //HelloWorld!
myString1 + " " + myString2 + "!"; //Hello World!
myString1 + ", " + myString2 + "!"; //Hello, World!
```
**Step by step, na wetin dey happen:**
- **Join** plenty strings together using the `+` operator
- **Put** strings together straight without space for di first example
- **Add** space characters `" "` between strings to make am easy to read
- **Put** punctuation like commas to make correct formatting
✅ Why e be like say `1 + 1 = 2` for JavaScript, but `'1' + '1' = 11?` Think am. Wetin about `'1' + 1`?
**Template literals** be another way to format strings, but e no dey use quotes, e dey use backtick. Anything wey no be plain text gats dey inside placeholders `${ }`. Dis one include any variables wey fit be strings.
```javascript
let myString1 = "Hello";
let myString2 = "World";
`${myString1} ${myString2}!` //Hello World!
`${myString1}, ${myString2}!` //Hello, World!
```
**Make we understand each part:**
- **Use** backticks `` ` `` instead of normal quotes to create template literals
- **Put** variables directly using `${}` placeholder syntax
- **Maintain** spaces and formatting exactly like e write
- **Give** better way to create complex strings with variables
You fit do your formatting goals with any method, but template literals go respect all spaces and line breaks.
✅ When you go use template literal vs. plain string?
### 🔤 **String Mastery Check: Text Manipulation Confidence**
**Check how you sabi strings:**
- Fit explain why `'1' + '1'` be `'11'` no be `2`?
- Which string method you find juicy: concatenation or template literals?
- Wetin fit happen if you forget put quotes around string?
```mermaid
stateDiagram-v2
[*] --> PlainText: "Hello"
[*] --> Variable: name = "Alice"
PlainText --> Concatenated: + " " + name
Variable --> Concatenated
PlainText --> Template: `Hello ${name}`
Variable --> Template
Concatenated --> Result: "Hello Alice"
Template --> Result
note right of Concatenated
Old syle way
Plenty talk
end note
note right of Template
New ES6 way
Clean and easy to sabi
end note
```
> **Pro tip:** Template literals dey mostly better for complex string building because dem dey easy to read and fit handle multi-line strings well well!
### Booleans
Booleans na di simplest kind data: dem fit only hold two values `true` or `false`. Dis binary logic system na from George Boole, one mathematician wey dey 19th century wey create Boolean algebra.
Even though dem simple, booleans dey important for program logic. Dem allow your code to make decision based on condition whether person don log in, if button don click, or if condition don meet.
Booleans fit only be two values: `true` or `false`. Dem fit help decide which lines of code suppose run when condition meet. For plenty cases, [operators](../../../../2-js-basics/1-data-types) dey help set Boolean value and you go dey always see and write variables wey dem declare or their values don change with operator.
```javascript
let myTrueBool = true;
let myFalseBool = false;
```
**For di above, we:**
- **Create** variable wey hold Boolean value `true`
- **Show** how to store Boolean value `false`
- **Use** correct keywords `true` and `false` (no need quotes)
- **Prepare** these variables to use for conditional statements
✅ Variable fit be 'truthy' if e evaluate to boolean `true`. Interesting, for JavaScript, [all values be truthy except wey dem define as falsy](https://developer.mozilla.org/docs/Glossary/Truthy).
```mermaid
flowchart LR
A["🔘 Boolean Values"] --> B["tru"]
A --> C["fols"]
D["Truthy Values"] --> D1["'helo'"]
D --> D2["42"]
D --> D3["[]"]
D --> D4["{}"]
E["Falsy Values"] --> E1["fols"]
E --> E2["0"]
E --> E3["''"]
E --> E4["null"]
E --> E5["undefined"]
E --> E6["NaN"]
style B fill:#e8f5e8
style C fill:#ffebee
style D fill:#e3f2fd
style E fill:#fff3e0
```
### 🎯 **Boolean Logic Check: Decision Making Skills**
**Test your boolean sense:**
- Why you think JavaScript get "truthy" and "falsy" values beyond `true` and `false`?
- Fit guess which one be falsy: `0`, `"0"`, `[]`, `"false"`?
- How booleans fit help control how program dey flow?
```mermaid
pie title "Common Boolean Use Cases"
"Conditional Logic" : 40
"User State" : 25
"Feature Toggles" : 20
"Validation" : 15
```
> **Remember:** For JavaScript, only 6 values dey falsy: `false`, `0`, `""`, `null`, `undefined`, and `NaN`. Everything wey remain dey truthy!
---
## 📊 **Your Data Types Toolkit Summary**
```mermaid
graph TD
A["🎯 JavaScript Data Types"] --> B["📦 Variables"]
A --> C["🔢 Numbers"]
A --> D["📝 Strings"]
A --> E["🔘 Booleans"]
B --> B1["let fit change"]
B --> B2["const no fit change"]
C --> C1["42, 3.14, -5"]
C --> C2["+ - * / %"]
D --> D1["'quotes' or \\\"quotes\\\""]
D --> D2["`template literals`"]
E --> E1["true or false"]
E --> E2["truthy vs falsy"]
F["⚡ Key Concepts"] --> F1["Type get meaning for operations"]
F --> F2["JavaScript dey dynamic type"]
F --> F3["Variables fit change type"]
F --> F4["Name get case-sensitive"]
style A fill:#e3f2fd
style B fill:#e8f5e8
style C fill:#fff3e0
style D fill:#f3e5f5
style E fill:#e0f2f1
style F fill:#fce4ec
```
## GitHub Copilot Agent Challenge 🚀
Use Agent mode complete this challenge:
**Description:** Create personal information manager wey fit show all JavaScript data types you don learn for this lesson and handle real-world data scenarios.
**Prompt:** Build JavaScript program wey go create user profile object get: person name (string), age (number), student status (boolean), favorite colors as array, plus address object with street, city, and zip code fields. Add functions to display profile info and update single fields. Make good use of string concatenation, template literals, arithmetic with age, plus boolean logic for student status.
Learn more about [agent mode](https://code.visualstudio.com/blogs/2025/02/24/introducing-copilot-agent-mode) here.
## 🚀 Challenge
JavaScript get some behavior wey fit surprise programmers. One classic example be: try type this for your browser console: `let age = 1; let Age = 2; age == Age` and watch the result. E go return `false` fit explain why?
Dis one na one of many JavaScript behavior wey you suppose sabi well. When you understand these kind wahala, you go fit write better code and debug well.
## Post-Lecture Quiz
[Post-lecture quiz](https://ff-quizzes.netlify.app)
## Review & Self Study
Make you check [this list of JavaScript exercises](https://css-tricks.com/snippets/javascript/) and try one. Wetin you learn?
## Assignment
[Data Types Practice](assignment.md)
## 🚀 Your JavaScript Data Types Mastery Timeline
### ⚡ **Wetyn You Fit Do for Next 5 Minutes**
- [ ] Open your browser console and create 3 variables with different data types
- [ ] Try the challenge: `let age = 1; let Age = 2; age == Age` and find out why e false
- [ ] Practice string concatenation with your name and favorite number
- [ ] Test wetin happen when you add number to string
### 🎯 **Wetyn You Fit Achieve This Hour**
- [ ] Complete post-lesson quiz and review any confusing thing
- [ ] Create mini calculator wey add, subtract, multiply, and divide two numbers
- [ ] Build simple name formatter using template literals
- [ ] Check the difference between `==` and `===` comparison operators
- [ ] Practice converting different data types from one to another
### 📅 **Your Week-Long JavaScript Foundation**
- [ ] Complete assignment with confidence and creativity
- [ ] Build personal profile object using all data types wey you don learn
- [ ] Practice with [JavaScript exercises from CSS-Tricks](https://css-tricks.com/snippets/javascript/)
- [ ] Build simple form validator using boolean logic
- [ ] Experiment with array and object data types (preview for coming lessons)
- [ ] Join JavaScript community and ask questions about data types
### 🌟 **Your Month-Long Transformation**
- [ ] Put data type knowledge inside bigger programming projects
- [ ] Know when and why to use each data type for real apps
- [ ] Help other beginners understand JavaScript fundamentals
- [ ] Build small app wey manage different types of user data
- [ ] Explore advanced data type concepts like type coercion and strict equality
- [ ] Contribute to open source JavaScript projects with better documentation
### 🧠 **Final Data Types Mastery Check-in**
**Celebrate your JavaScript base:**
- Which data type surprise you pass concerning how e dey behave?
- How you feel explaining variables vs. constants to your friend?
- Wetin be the most interesting thing wey you find out about JavaScript type system?
- Which real-world app you fit imagine to build using these fundamentals?
```mermaid
journey
title Your JavaScript Confidence Journey
section Today
Confused: 3: You
Curious: 4: You
Excited: 5: You
section This Week
Practicing: 4: You
Understanding: 5: You
Building: 5: You
section Next Month
Problem Solving: 5: You
Teaching Others: 5: You
Real Projects: 5: You
```
> 💡 **You don build strong foundation!** To sabi data types na like to learn alphabet before you start write story. Every JavaScript program wey you go write go use these basic concepts. Now you get the building blocks to create interactive websites, dynamic apps, and solve real-world problems wit code. Welcome to JavaScript world! 🎉
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document na AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator) translate am. Even though we dey try make am correct, abeg sabi say automated translation fit get mistake or no too correct. Di original document wey dem write for dia own language na di correct one. If na serious matter, make you use professional human translation. We no go take responsibility if person nor understand well or if dem use this translation do wrong yawa.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,103 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "6fd645e97c48cd5eb5a3d290815ec8b5",
"translation_date": "2026-01-08T12:42:45+00:00",
"source_file": "2-js-basics/1-data-types/assignment.md",
"language_code": "pcm"
}
-->
# Data Types Practice: E-commerce Shopping Cart
## Instructions
Imagine say you dey build modern e-commerce shopping cart system. Dis assignment go help you understand how different JavaScript data types dey work together to create real-world applications.
### Your Task
Create complete analysis of how you go take use JavaScript data types inside shopping cart application. For each of di seven primitive data types and objects, you need to:
1. **Identify** di data type and wetin e dey do
2. **Explain** why dis data type na di best choice for specific shopping cart features
3. **Provide** realistic code examples wey show di data type for action
4. **Describe** how dis data type dey interact wit oda parts of di shopping cart
### Required Data Types to Cover
**Primitive Data Types:**
- **String**: Product names, descriptions, user information
- **Number**: Prices, quantities, tax calculations
- **Boolean**: Item availability, user preferences, cart status
- **Null**: Intentionally empty values (like missing discount codes)
- **Undefined**: Uninitialized values or missing data
- **Symbol**: Unique identifiers (advanced use)
- **BigInt**: Large financial calculations (advanced use)
**Reference Types:**
- **Object**: Product details, user profiles, cart contents
- **Array**: List of products, order history, categories
### Example Format for Each Data Type
For each data type, structure your response like dis:
```markdown
## [Data Type Name]
**Purpose in Shopping Cart:** [Explain what this data type does]
**Why This Type:** [Explain why this is the best choice]
**Code Example:**
```javascript
// Your realistic code example here
```
**Real-world Usage:** [Describe how this go work for practice]
**Interactions:** [Explain how dis data type dey work wit oda ones]
```
### Bonus Challenges
1. **Type Coercion**: Show an example where JavaScript automatically converts between data types in your shopping cart (e.g., string "5" + number 10)
2. **Data Validation**: Demonstrate how you would check if user input is the correct data type before processing
3. **Performance Considerations**: Explain when you might choose one data type over another for performance reasons
### Submission Guidelines
- Create a markdown document with clear headings for each data type
- Include working JavaScript code examples
- Use realistic e-commerce scenarios in your examples
- Explain your reasoning clearly for beginners to understand
- Test your code examples to ensure they work correctly
## Rubric
| Criteria | Exemplary (90-100%) | Proficient (80-89%) | Developing (70-79%) | Needs Improvement (Below 70%) |
|----------|---------------------|---------------------|---------------------|------------------------------|
| **Data Type Coverage** | All 7 primitive types and objects/arrays covered with detailed explanations | 6-7 data types covered with good explanations | 4-5 data types covered with basic explanations | Fewer than 4 data types or minimal explanations |
| **Code Examples** | All examples are realistic, working, and well-commented | Most examples work and are relevant to e-commerce | Some examples work but may be generic | Code examples are incomplete or non-functional |
| **Real-world Application** | Clearly connects each data type to practical shopping cart features | Good connection to e-commerce scenarios | Some connection to shopping cart context | Limited real-world application demonstrated |
| **Technical Accuracy** | All technical information is correct and demonstrates deep understanding | Most technical information is accurate | Generally accurate with minor errors | Contains significant technical errors |
| **Communication** | Explanations are clear, beginner-friendly, and well-organized | Good explanations that are mostly clear | Explanations are understandable but may lack clarity | Explanations are unclear or poorly organized |
| **Bonus Elements** | Includes multiple bonus challenges with excellent execution | Includes one or more bonus challenges well done | Attempts bonus challenges with mixed success | No bonus challenges attempted |
### Learning Objectives
By completing this assignment, you will:
- ✅ **Understand** the seven JavaScript primitive data types and their uses
- ✅ **Apply** data types to real-world programming scenarios
- ✅ **Analyze** when to choose specific data types for different purposes
- ✅ **Create** working code examples that demonstrate data type usage
- ✅ **Explain** technical concepts in beginner-friendly language
- ✅ **Connect** fundamental programming concepts to practical applications
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document don translate by AI translation service wey dem dey call [Co-op Translator](https://github.com/Azure/co-op-translator). Even though we try make everything correct, abeg sabi say automated translation fit get some mistakes or wahala. The original document wey dem write for im correct language na im be the real correct one. If na serious matter, e good make person wey sabi human translator do am. We no go gree if any misunderstanding or wahala show because of this translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,584 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "71f7d7dafa1c7194d79ddac87f669ff9",
"translation_date": "2026-01-08T12:20:24+00:00",
"source_file": "2-js-basics/2-functions-methods/README.md",
"language_code": "pcm"
}
-->
# JavaScript Basics: Methods and Functions
![JavaScript Basics - Functions](../../../../translated_images/webdev101-js-functions.be049c4726e94f8b.pcm.png)
> Sketchnote by [Tomomi Imura](https://twitter.com/girlie_mac)
```mermaid
journey
title Your JavaScript Functions Adventure
section Foundation
Function Syntax: 5: You
Calling Functions: 4: You
Parameters & Arguments: 5: You
section Advanced Concepts
Return Values: 4: You
Default Parameters: 5: You
Function Composition: 4: You
section Modern JavaScript
Arrow Functions: 5: You
Anonymous Functions: 4: You
Higher-Order Functions: 5: You
```
## Pre-Lecture Quiz
[Pre-lecture quiz](https://ff-quizzes.netlify.app)
Writa di same code plenti taem na one of di wahala we programmer dem dey face. Functions na im dey solve dis problem by make you fit bundle code inside plenti places wey you fit reuse am. Think of functions like di standardized parts wey Henry Ford first use for hin assembly line once you create one reliable part, you fit use am anywhere without to build am from di beginning.
Functions dey help you bundle pieces of code so that you fit reuse dem everywhere for your program. Instead to dey copy and paste di same logic anyhow, you fit create one function once and call am anytime you want. Dis style sabi keep your code clean and e go make am easy to update.
For dis lesson, you go learn how to create your own functions, how to pass information enter dem, and how to get useful result back. You go sabi di difference between functions and methods, learn how to use modern syntax, and see how functions fit work with other functions dem. We go build all dis small small.
[![Methods and Functions](https://img.youtube.com/vi/XgKsD6Zwvlc/0.jpg)](https://youtube.com/watch?v=XgKsD6Zwvlc "Methods and Functions")
> 🎥 Click di image for video wey talk about methods and functions.
> You fit take dis lesson for [Microsoft Learn](https://docs.microsoft.com/learn/modules/web-development-101-functions/?WT.mc_id=academic-77807-sagibbon)!
```mermaid
mindmap
root((JavaScript Functions))
Basic Concepts
Declaration
Traditional syntax
Arrow function syntax
Calling
Using parentheses
Parentheses required
Parameters
Input Values
Multiple parameters
Default values
Arguments
Values passed in
Fit be any kain
Return Values
Output Data
return statement
Exit function
Use Results
Store for variables
Chain functions
Advanced Patterns
Higher-Order
Functions as parameters
Callbacks
Anonymous
No name needed
Inline definition
```
## Functions
Function na one self-contained block of code wey dey do specific task. E dey hold logic wey you fit run anytime you want.
Instead make you dey write di same code many many times for your program, you fit pack am inside function and call di function anytime you need am. Dis style dey keep your code neat and e go make any update easier. Imagine say you get one logic wey spread all over your codebase for 20 places and you wan change am.
Make you dey give your functions correct names and names weh mean something. Good name for function go make am clear wetin e do when you see `cancelTimer()`, you sabi immediately wetin e mean, like button wey get clear label wey you sabi wetin e go do when you press am.
## How to create and call function
Make we check how to create function. Di syntax dey:
```javascript
function nameOfFunction() { // function definition
// function definition/body
}
```
Make we break dis down:
- Di `function` keyword dey tell JavaScript say "Hey, I dey create function!"
- `nameOfFunction` na where you go put correct function name
- Di parentheses `()` na where you fit put parameters (we go yarn about dat later)
- Di curly braces `{}` hold di code wey go run once you call di function
Make we create simple greeting function make you see am:
```javascript
function displayGreeting() {
console.log('Hello, world!');
}
```
Dis function dey print "Hello, world!" for console. Once you define am, you fit use am many times.
To run (or "call") your function, write di name and follow am with parentheses. JavaScript fit allow you define your function before or after you call am di JavaScript engine go handle am correct.
```javascript
// we dey call our function
displayGreeting();
```
When you run dis line, e go run all di code wey dey inside `displayGreeting` function, and go show "Hello, world!" for your browser console. You fit call dis function over and over.
### 🧠 **Function Fundamentals Check: Building Your First Functions**
**Make we test how you dey understand basic functions:**
- Why you dey use curly braces `{}` for function definition?
- Wetin go happen if you write `displayGreeting` without parentheses?
- Why you fit want call di same function many times?
```mermaid
flowchart TD
A["✏️ Define Function"] --> B["📦 Package Code"]
B --> C["🏷️ Giv am Naim"]
C --> D["📞 Call Wen E Dey Needed"]
D --> E["🔄 Reuse Anywɛa"]
F["💡 Benefits"] --> F1["No code repetition"]
F --> F2["Ezi to maintain"]
F --> F3["Clear organization"]
F --> F4["Ezi to test"]
style A fill:#e3f2fd
style E fill:#e8f5e8
style F fill:#fff3e0
```
> **Note:** You don dey use **methods** dem all dis time for di lessons. `console.log()` na method e be function wey belong to `console` object. Di main difference be say method dey attached to object, but functions dey stand-alone. Plenti developers dey use di two words one way one time when dem dey talk.
### Function best practices
Here na small tips to help you write better functions:
- Give your functions clear and correct names your future sef go thank you!
- Use **camelCasing** for multi-word names (like `calculateTotal` not `calculate_total`)
- Make sure each function dey focused on doing one thing well
## Passing information to function
Our `displayGreeting` function no flexible e just dey display "Hello, world!" for everybody. Parameters dey help make functions flexible and useful.
**Parameters** na placeholders wey you fit put different values anytime you call di function. Dis one mean say di same function fit use different information anytime you call am.
You dey put parameters inside di parentheses when you dey define function, and separate multiple parameters with commas:
```javascript
function name(param, param2, param3) {
}
```
Each parameter na like placeholder when person call your function, dem go give real values wey go enter these spots.
Make we update our greeting function to carry person name inside:
```javascript
function displayGreeting(name) {
const message = `Hello, ${name}!`;
console.log(message);
}
```
You fit see say we dey use backticks (`` ` ``) and `${}` to put name directly inside di message - dis na template literal, e sweet well well to build string with variables inside.
Now when we call the function, we fit pass any name:
```javascript
displayGreeting('Christopher');
// dey show "Hello, Christopher!" wen e run
```
JavaScript go carry di string `'Christopher'`, put am for `name` parameter, and create personalized message "Hello, Christopher!"
```mermaid
flowchart LR
A["🎯 Function Call"] --> B["📥 Parameters"]
B --> C["⚙️ Function Body"]
C --> D["📤 Result"]
A1["displayGreeting('Alice')"] --> A
B1["name = 'Alice'"] --> B
C1["Template literal\n\`Hello, \${name}!\`"] --> C
D1["'Hello, Alice!'"] --> D
E["🔄 Parameter Types"] --> E1["String dem"]
E --> E2["Numbers"]
E --> E3["Booleans"]
E --> E4["Objects"]
E --> E5["Functions"]
style A fill:#e3f2fd
style C fill:#e8f5e8
style D fill:#fff3e0
style E fill:#f3e5f5
```
## Default values
Wetin you go do if you want make some parameters optional? Na dis time default values help!
Make we say you want make people fit choose greeting word, but if dem no put anything, you go use "Hello" as fallback. You fit set default values with equals sign like how you dey set variable:
```javascript
function displayGreeting(name, salutation='Hello') {
console.log(`${salutation}, ${name}`);
}
```
Here, `name` still be required, but `salutation` get backup value `'Hello'` if person no provide other greeting.
Now we fit call dis function two ways:
```javascript
displayGreeting('Christopher');
// dey show "Hello, Christopher"
displayGreeting('Christopher', 'Hi');
// dey show "Hi, Christopher"
```
For first call, JavaScript use default "Hello" because we no send salutation. For second call, e use our custom "Hi". Dis flexi make function fit different situation.
### 🎛️ **Parameters Mastery Check: Making Functions Flexible**
**Test your parameter sabi:**
- Wetin be difference between parameter and argument?
- Why default values dey important for real-world programming?
- Wetin you tink go happen if you pass more arguments than parameters?
```mermaid
stateDiagram-v2
[*] --> NoParams: function greet() {}
[*] --> WithParams: function greet(name) {}
[*] --> WithDefaults: function greet(name, greeting='Hi') {}
NoParams --> Static: Di same output every time
WithParams --> Dynamic: E dey change wit input
WithDefaults --> Flexible: Optional customization
Static --> [*]
Dynamic --> [*]
Flexible --> [*]
note right of WithDefaults
Di most flexible way
E still fit work wit old one dem
end note
```
> **Pro tip**: Default parameters dey make functions more user-friendly. User fit start quickly with normal default values, but still fit customize as dem want!
## Return values
So far, our functions just dey print messages to console, but wetin you go do if you want say function go calculate something and give you result back?
Na here **return values** come. Instead to just display something, function fit give you value wey you fit save inside variable or use for other parts of your code.
To send value back, use `return` keyword follow am with wetin you want return:
```javascript
return myVariable;
```
One important thing be say: once function hit `return`, e go stop immediately and send dat value to di person wey call am.
Make we change our greeting function to return message instead of printing am:
```javascript
function createGreetingMessage(name) {
const message = `Hello, ${name}`;
return message;
}
```
Now, this function no longer print greeting, e just create message and give am back to us.
To use di returned value, we fit hold am inside variable like any value:
```javascript
const greetingMessage = createGreetingMessage('Christopher');
```
Now `greetingMessage` get "Hello, Christopher" and we fit use am anywhere for code to show for web page, put for email, or pass am to another function.
```mermaid
flowchart TD
A["🔧 Function Processing"] --> B{"return statement?"}
B -->|Yes| C["📤 Return Value"]
B -->|No| D["📭 Return undefined"]
C --> E["💾 Store am for Variable"]
C --> F["🔗 Use am for Expression"]
C --> G["📞 Pass am go Function"]
D --> H["⚠️ Most times no dey useful"]
I["📋 How dem dey use Return Value"] --> I1["Calculate results"]
I --> I2["Validate input"]
I --> I3["Transform data"]
I --> I4["Create objects"]
style C fill:#e8f5e8
style D fill:#ffebee
style I fill:#e3f2fd
```
### 🔄 **Return Values Check: Getting Results Back**
**Test how you understand return values:**
- Wetin happen to code wey dey after `return` inside function?
- Why e better to return values than just to print to console?
- Fit function return different type of values (string, number, boolean)?
```mermaid
pie title "Common Return Value Types"
"Strinz" : 30
"Nambas" : 25
"Objeks" : 20
"Boolis" : 15
"Erays" : 10
```
> **Main gist**: Functions wey return values dey flexible because di caller fit decide wetin to do with di result. Dis one make your code modular and reusable!
## Functions as parameters for functions
Functions fit pass as parameters to other functions. Even though e fit look hard at first, na powerful way to enable flexible programming.
Dis pattern common when you want say "when sometin happen, do another tin." Like "when timer finish, run dis code" or "when user click button, call dis function."
Make we see `setTimeout` wey be built-in function wey go wait small time then run code. We need tell am wetin to run perfect case to pass function as parameter!
Try dis code after 3 seconds, you go see message:
```javascript
function displayDone() {
console.log('3 seconds has elapsed');
}
// timer value dey for milliseconds
setTimeout(displayDone, 3000);
```
See as we pass `displayDone` (without parentheses) to `setTimeout`. We no dey call function ourselves we just dey give am to `setTimeout`, tell am "call dis function after 3 seconds."
### Anonymous functions
Sometimes you need function for one thing only and you no want give am name. Think am if you dey use function only once, why you go put extra name for code?
JavaScript allow you create **anonymous functions** functions wey no get name, wey you fit define exactly where you need am.
Here how we fit rewrite our timer example using anonymous function:
```javascript
setTimeout(function() {
console.log('3 seconds has elapsed');
}, 3000);
```
Dis one do the same thing, but function dey defined inside `setTimeout` call, no need separate function declaration.
### Fat arrow functions
Modern JavaScript get one shorter way to write function wey dem call **arrow functions**. Dem use `=>` (wey look like arrow) and developers love am.
Arrow functions let you skip `function` keyword and write shorter code.
Here be our timer example with arrow function:
```javascript
setTimeout(() => {
console.log('3 seconds has elapsed');
}, 3000);
```
Di `()` na where parameters fit go (empty here), then di arrow `=>`, then function body inside curly braces. Dis one dey do same thing but in shorter way.
```mermaid
flowchart LR
A["📝 Function Styles"] --> B["Traditional"]
A --> C["Arrow"]
A --> D["Anonymous"]
B --> B1["function name() {}"]
B --> B2["Hoisted"]
B --> B3["Named"]
C --> C1["const name = () => {}"]
C --> C2["Concise syntax"]
C --> C3["Modern style"]
D --> D1["function() {}"]
D --> D2["No name"]
D --> D3["One-time use"]
E["⏰ Wen to Use"] --> E1["Traditional: Functions we fit use again"]
E --> E2["Arrow: Short callbacks"]
E --> E3["Anonymous: Event handlers"]
style A fill:#e3f2fd
style B fill:#e8f5e8
style C fill:#fff3e0
style D fill:#f3e5f5
style E fill:#e0f2f1
```
### When to use each style
When you suppose use each style? Rule of thumb: if you go use function many times, give am name and define am separately. If na for one special thing, use anonymous function. Both arrow functions and normal functions good, but arrow functions dey popular for modern code.
### 🎨 **Function Styles Mastery Check: Choosing the Right Syntax**
**Test your syntax sabi:**
- When you go prefer arrow functions pass traditional syntax?
- Wetin be main advantage of anonymous functions?
- Fit you give example where named function better than anonymous?
```mermaid
quadrantChart
title Function Choice Decision Matrix
x-axis Simple --> Complex
y-axis One-time use --> Reusable
quadrant-1 Arrow Functions
quadrant-2 Named Functions
quadrant-3 Anonymous Functions
quadrant-4 Traditional Functions
Event Handlers: [0.3, 0.2]
Utility Functions: [0.7, 0.8]
Callbacks: [0.2, 0.3]
Class Methods: [0.8, 0.7]
Mathematical Operations: [0.4, 0.6]
```
> **Modern trend**: Arrow functions dey become default choice for many developers because syntax tight, but traditional functions still get place!
---
## 🚀 Challenge
Fit talk wetin be difference between functions and methods inside one sentence? Try am!
## GitHub Copilot Agent Challenge 🚀
Use Agent mode do this challenge:
**Description:** Create utility library of maths functions wey show different function concepts wey dem teach for dis lesson, including parameters, default values, return values, and arrow functions.
**Prompt:** Create JavaScript file wey name `mathUtils.js` wey get these functions:
1. Function `add` wey get two parameters and return their sum
2. Function `multiply` wey get default parameter values (second default to 1)
3. Arrow function `square` wey take number and return square
4. Function `calculate` wey accept another function as parameter plus two numbers, then apply function to those numbers
5. Show how to call each function with correct test cases
Learn more about [agent mode](https://code.visualstudio.com/blogs/2025/02/24/introducing-copilot-agent-mode) here.
## Post-Lecture Quiz
[Post-lecture quiz](https://ff-quizzes.netlify.app)
## Review & Self Study
E good to [read small more about arrow functions](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Functions/Arrow_functions) as people dey use dem more for code. Practice write function, then rewrite am with dis syntax.
## Assignment
[Fun with Functions](assignment.md)
---
## 🧰 **Your JavaScript Functions Toolkit Summary**
```mermaid
graph TD
A["🎯 JavaScript Functions"] --> B["📋 Function Declaration"]
A --> C["📥 Parameters"]
A --> D["📤 Return Values"]
A --> E["🎨 Modern Syntax"]
B --> B1["function name() {}"]
B --> B2["Descriptive naming"]
B --> B3["Reusable code blocks"]
C --> C1["Input data"]
C --> C2["Default values"]
C --> C3["Multiple parameters"]
D --> D1["return statement"]
D --> D2["Exit function"]
D --> D3["Pass data back"]
E --> E1["Arrow functions: () =>"]
E --> E2["Anonymous functions"]
E --> E3["Higher-order functions"]
F["⚡ Key Benefits"] --> F1["Code reusability"]
F --> F2["Better organization"]
F --> F3["Easier testing"]
F --> F4["Modular design"]
style A fill:#e3f2fd
style B fill:#e8f5e8
style C fill:#fff3e0
style D fill:#f3e5f5
style E fill:#e0f2f1
style F fill:#fce4ec
```
---
## 🚀 Your JavaScript Functions Mastery Timeline
### ⚡ **Wetin You Fit Do for Next 5 Minutes**
- [ ] Write simple function wey go return your favorite number
- [ ] Create function wey get two parameters wey go add dem together
- [ ] Try convert traditional function to arrow function syntax
- [ ] Practice di challenge: explain di difference between functions and methods
### 🎯 **Wetin You Fit Achieve Dis Hour**
- [ ] Complete di post-lesson quiz and review any confusing tins
- [ ] Build di math utilities library from di GitHub Copilot challenge
- [ ] Create one function wey dey use another function as parameter
- [ ] Practice to write functions with default parameters
- [ ] Experiment with template literals for function return values
### 📅 **Your Week-Long Function Mastery**
- [ ] Complete di "Fun with Functions" assignment wit creativity
- [ ] Refactor some repetitive code wey you don write into reusable functions
- [ ] Build small calculator wey only use functions (no global variables)
- [ ] Practice arrow functions wit array methods like `map()` and `filter()`
- [ ] Create collection of utility functions for common tasks
- [ ] Study higher-order functions and functional programming concepts
### 🌟 **Your Month-Long Transformation**
- [ ] Master advanced function concepts like closures and scope
- [ ] Build project wey heavy use function composition
- [ ] Contribute to open source by improving function documentation
- [ ] Teach person else about functions and different syntax styles
- [ ] Explore functional programming paradigms for JavaScript
- [ ] Create personal library of reusable functions for future projects
### 🏆 **Final Functions Champion Check-in**
**Celebrate your function mastery:**
- Wetin be di most useful function wey you don create so far?
- How learning about functions don change how you dey think about code organization?
- Which function syntax you prefer and why?
- Which real-world problem you go solve by writing function?
```mermaid
journey
title Your Function Confidence Evolution
section Tode
Confused by Syntax: 3: You
Understanding Basics: 4: You
Writing Simple Functions: 5: You
section Dis Week
Using Parameters: 4: You
Returning Values: 5: You
Modern Syntax: 5: You
section Next Month
Function Composition: 5: You
Advanced Patterns: 5: You
Teaching Others: 5: You
```
> 🎉 **You don master one of programming's most powerful concepts!** Functions na di building blocks of bigger programs. Every application wey you go build go use functions to organize, reuse, and structure code. Now you sabi how to package logic into reusable components, wey go make you more efficient and effective programmer. Welcome to di world of modular programming! 🚀
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis dokument don translate wit AI translation service wey dem call [Co-op Translator](https://github.com/Azure/co-op-translator). Even tho we dey try make am correct, abeg make you sabi say machine translation fit get some mistake or no be correct sotey. Di original dokument wey dem write for di language wey e come from na di main one wey get authority. If na serious matter, better make professional human translator help you do am. We no go responsible for any yawa or wrong understanding wey fit happen because of dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,82 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "8328f58f4593b4671656ff8f4b2edbd9",
"translation_date": "2026-01-08T12:28:48+00:00",
"source_file": "2-js-basics/2-functions-methods/assignment.md",
"language_code": "pcm"
}
-->
# Fun wit Functions
## Instructions
For dis assignment, you go practice to create different kain functions to hala the concepts wey you don learn about JavaScript functions, parameters, default values, and return statements.
Create one JavaScript file wey dem dey call `functions-practice.js` and implement the following functions:
### Part 1: Basic Functions
1. **Create function wey dem go call `sayHello`** wey no go carry any parameters and e go just log "Hello!" for console.
2. **Create function wey dem go call `introduceYourself`** wey go carry one `name` parameter and e go log message like "Hi, my name na [name]" for console.
### Part 2: Functions with Default Parameters
3. **Create function wey dem go call `greetPerson`** wey go carry two parameters: `name` (wey suppose dey) and `greeting` (optional, default na "Hello"). The function suppose log message like "[greeting], [name]!" for console.
### Part 3: Functions wey Dey Return Values
4. **Create function wey dem go call `addNumbers`** wey go carry two parameters (`num1` and `num2`) and e go return their sum.
5. **Create function wey dem go call `createFullName`** wey go carry `firstName` and `lastName` parameters and e go return the full name as one single string.
### Part 4: Mix Am All Together
6. **Create function wey dem go call `calculateTip`** wey go carry two parameters: `billAmount` (wey suppose dey) and `tipPercentage` (optional, default na 15). The function suppose calculate and return the tip amount.
### Part 5: Test Your Functions
Add function calls to test each one of your functions and show the results using `console.log()`.
**Example test calls:**
```javascript
// Test your function dem here
sayHello();
introduceYourself("Sarah");
greetPerson("Alex");
greetPerson("Maria", "Hi");
const sum = addNumbers(5, 3);
console.log(`The sum is: ${sum}`);
const fullName = createFullName("John", "Doe");
console.log(`Full name: ${fullName}`);
const tip = calculateTip(50);
console.log(`Tip for $50 bill: $${tip}`);
```
## Rubric
| Criteria | Exemplary | Adequate | Needs Improvement |
| -------- | --------- | -------- | ----------------- |
| **Function Creation** | All 6 functions dem dey correctly implement with correct syntax and naming conventions | 4-5 functions dem dey correctly implement with small syntax issues | 3 or less functions implement or big syntax wahala |
| **Parameters & Default Values** | Correctly use the parameters wey dem suppose use, optional parameters, and default values as dem talk | Parameters dey okay but e fit get problem with default values | Parameters no correct or missing |
| **Return Values** | Functions wey suppose return values, dem dey return am correct, and functions wey no suppose return, dem just dey perform action | Majority return values dey okay but small issues dey | Big problem for return statements |
| **Code Quality** | Clean, well-organized code with better variable names and proper indentation | Code work but fit better or better organize | Code hard to read or e poor |
| **Testing** | All functions dem test well with correct calls and results show well | Majority functions dem test well | Testing no complete or e wrong |
## Bonus Challenges (Optional)
If you want take challenge yourself more:
1. **Create arrow function version** for one of your functions
2. **Create one function wey dey carry another function as parameter** (like the `setTimeout` examples wey dey inside lesson)
3. **Add input validation** to make sure your functions fit handle bad inputs well
---
> 💡 **Tip**: Make you remember to open your browser developer console (F12) to fit see the output of your `console.log()` statements!
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document don translate wit AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator). Even though we try make e correct, abeg sabi say automated translations fit get some mistakes or wahala. Di original document for im own language na di correct source. If na serious tins, make person wey sabi do professional human translation do am. We no responsible if mistake or misunderstanding show because of dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,672 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "c688385d15dd3645e924ea0ffee8967f",
"translation_date": "2026-01-08T12:44:13+00:00",
"source_file": "2-js-basics/3-making-decisions/README.md",
"language_code": "pcm"
}
-->
# JavaScript Basics: Making Decisions
![JavaScript Basics - Making decisions](../../../../translated_images/webdev101-js-decisions.69e1b20f272dd1f0.pcm.png)
> Sketchnote by [Tomomi Imura](https://twitter.com/girlie_mac)
```mermaid
journey
title Your JavaScript Decision-Making Adventure
section Foundation
Boolean Values: 5: You
Comparison Operators: 4: You
Logical Thinking: 5: You
section Basic Decisions
If Statements: 4: You
If-Else Logic: 5: You
Switch Statements: 4: You
section Advanced Logic
Logical Operators: 5: You
Complex Conditions: 4: You
Ternary Expressions: 5: You
```
You don ever wonder how applications dey make correct decisions? Like how navigation system dey pick di fastest road, or how thermostat know when e go turn on heat? Na di koko idea of decision-making for programming be dis.
Just like how Charles Babbage Analytical Engine design to follow different sequence of operations based on some conditions, modern JavaScript programs need to make choice based on varying condition dem. Dis ability to branch out and make decision na wetin dey turn static code to smart, responsive apps.
For dis lesson, you go learn how to implement conditional logic for your programs. We go explore conditional statements, comparison operators, and logical expressions wey go allow your code check situation and respond well.
## Pre-Lecture Quiz
[Pre-lecture quiz](https://ff-quizzes.netlify.app/web/quiz/11)
Di ability to make decisions and control program flow na one important part of programming. Dis section go show how you fit control how your JavaScript program dey run using Boolean values and conditional logic.
[![Making Decisions](https://img.youtube.com/vi/SxTp8j-fMMY/0.jpg)](https://youtube.com/watch?v=SxTp8j-fMMY "Making Decisions")
> 🎥 Click di picture wey dey top for video about making decisions.
> You fit take dis lesson for [Microsoft Learn](https://docs.microsoft.com/learn/modules/web-development-101-if-else/?WT.mc_id=academic-77807-sagibbon)!
```mermaid
mindmap
root((Decision Making))
Boolean Logic
true/false
Comparison results
Logical expressions
Conditional Statements
if statements
Single condition
Code execution
if-else
Two paths
Alternative actions
switch
Multiple options
Clean structure
Operators
Comparison
=== !== < > <= >=
Value relationships
Logical
&& || !
Combine conditions
Advanced Patterns
Ternary
? : syntax
Inline decisions
Complex Logic
Nested conditions
Multiple criteria
```
## A Brief Recap on Booleans
Before we start decision-making, make we remember Boolean values from our last lesson. Named after mathematician George Boole, dis values mean binary states e fit be `true` or `false`. No wahala, no middle ground.
Dis binary values na di foundation for all computational logic. Every decision your program make, at the end be Boolean evaluation.
To create Boolean variables no too hard:
```javascript
let myTrueBool = true;
let myFalseBool = false;
```
Dis one create two variables wey get explicit Boolean values.
✅ Booleans get their name from English mathematician, philosopher and logician George Boole (18151864).
## Comparison Operators and Booleans
For practice, you no go usually dey set Boolean values by hand. You go dey generate them by checking conditions: "Dis number bigger pass dat?" or "Dem two values be equal?"
Comparison operators na wetin dey do dis checking. Dem dey compare values and return Boolean result based on how the two things relate.
| Symbol | Description | Example |
| ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |
| `<` | **Less than**: Dey compare two values, returns `true` if the value wey dey left side smaller than the one wey dey right | `5 < 6 // true` |
| `<=` | **Less than or equal to**: Returns `true` if value wey dey left side smaller or equal to the one wey dey right | `5 <= 6 // true` |
| `>` | **Greater than**: Returns `true` if value wey dey left side bigger pass the one wey dey right | `5 > 6 // false` |
| `>=` | **Greater than or equal to**: Returns `true` if value wey dey left side bigger or equal to the one wey dey right | `5 >= 6 // false` |
| `===` | **Strict equality**: Returns `true` if values for both left and right side equal AND their data types na the same | `5 === 6 // false` |
| `!==` | **Inequality**: Returns opposite of wetin strict equality go return | `5 !== 6 // true` |
✅ Try test your knowledge by writing some comparisons for your browser console. Any result go surprise you?
```mermaid
flowchart LR
A["🔢 Values"] --> B["⚖️ Comparison"]
B --> C["✅ Boolean Result"]
D["5"] --> E["< 6"]
E --> F["tru"]
G["10"] --> H["=== '10'"]
H --> I["folo"]
J["'hello'"] --> K["!== 'world'"]
K --> L["tru"]
M["📋 Operator Types"] --> M1["Equality: === !=="]
M --> M2["Relational: < > <= >="]
M --> M3["Strict vs Loose"]
style A fill:#e3f2fd
style C fill:#e8f5e8
style M fill:#fff3e0
```
### 🧠 **Comparison Mastery Check: Understanding Boolean Logic**
**Test your sabi about comparison:**
- Why you think say `===` (strict equality) dey better pass `==` (loose equality)?
- Wetin you think `5 === '5'` go return? How about `5 == '5'`?
- Wetin be di difference between `!==` and `!=`?
```mermaid
stateDiagram-v2
[*] --> Comparison: Two values
Comparison --> StrictEqual: === or !==
Comparison --> Relational: < > <= >=
StrictEqual --> TypeCheck: Check type AND value
Relational --> NumberCompare: Convert to numbers
TypeCheck --> BooleanResult: true or false
NumberCompare --> BooleanResult
note right of StrictEqual
Beta way
No type conversion
end note
note right of Relational
E good for range dem
Number compare dem
end note
```
> **Pro tip**: Always use `===` and `!==` for equality checks unless you specifically want type to convert. Dis one dey prevent surprise behavior!
## If Statement
`if` statement na like to ask question for your code. "If dis condition true, then do dis tin." E dey important well well for making decisions for JavaScript.
E dey work like dis:
```javascript
if (condition) {
// Condition na true. Code wey dey inside dis block go run.
}
```
Di condition dey inside di parentheses, if e `true`, JavaScript go run di code wey dey inside di curly braces. If e `false`, e go just skip dat block.
Normally you go dey use comparison operators to make these conditions. Make we see example wey dey real:
```javascript
let currentMoney = 1000;
let laptopPrice = 800;
if (currentMoney >= laptopPrice) {
// Condition dey true. Code for dis block go run.
console.log("Getting a new laptop!");
}
```
Since `1000 >= 800` be `true`, code inside the block go run, and e go display "Getting a new laptop!" for console.
```mermaid
flowchart TD
A["🚀 Program Don Start"] --> B{"💰 currentMoney >= laptopPrice?"}
B -->|true| C["🎉 'Dey get new laptop!'"]
B -->|false| D["⏭️ Skip code block"]
C --> E["📋 Continue program"]
D --> E
F["📊 If Statement Structure"] --> F1["if (condition) {"]
F1 --> F2[" // code to run if true"]
F2 --> F3["}"]
style B fill:#fff3e0
style C fill:#e8f5e8
style D fill:#ffebee
style F fill:#e3f2fd
```
## If..Else Statement
But if you want make your program do differently when condition be false? Na here `else` come play e be like backup plan.
`else` statement go allow you talk say "if dis condition no true, make e do dis other thing."
```javascript
let currentMoney = 500;
let laptopPrice = 800;
if (currentMoney >= laptopPrice) {
// Condition na true. Code wey dey inside dis block go run.
console.log("Getting a new laptop!");
} else {
// Condition na false. Code wey dey inside dis block go run.
console.log("Can't afford a new laptop, yet!");
}
```
Now since `500 >= 800` be `false`, JavaScript no run first block, e jump run `else` block instead. You go see "Can't afford a new laptop, yet!" for console.
✅ Test as you understand dis code and the next one by running for browser console. Change value of currentMoney and laptopPrice to see different `console.log()` result.
### 🎯 **If-Else Logic Check: Branching Paths**
**Check how you understand if-else logic:**
- Wetin go happen if `currentMoney` exactly equal `laptopPrice`?
- You fit think of real life example where if-else logic go make sense?
- How you for fit extend dis to handle multiple price ranges?
```mermaid
flowchart TD
A["🔍 Check Condition"] --> B{"Condition True?"}
B -->|Yes| C["📤 Run IF block"]
B -->|No| D["📥 Run ELSE block"]
C --> E["✅ One path don run"]
D --> E
F["🌐 Real-world Examples"] --> F1["User login status"]
F --> F2["Age verification"]
F --> F3["Form validation"]
F --> F4["Game state changes"]
style B fill:#fff3e0
style C fill:#e8f5e8
style D fill:#e3f2fd
style F fill:#f3e5f5
```
> **Important**: If-else guarantee say exactly one path go run. Dis one sure say your program go get answer for any condition!
## Switch Statement
Sometimes you need compare one value with many options. Though you fit chain many `if..else`, e fit get messy. `switch` statement dey give cleaner structure to handle multiple values.
E dey like mechanical switches wey telephone exchange dem dey use one input value go decide which path to take.
```javascript
switch (expression) {
case x:
// code block
break;
case y:
// code block
break;
default:
// code block
}
```
Dis na how e dey structured:
- JavaScript go check the expression once
- E go check every `case` to find one wey match
- Once e find one, e go run dat code block
- `break` dey tell JavaScript to stop and leave switch
- If no case match, e go run `default` block if you get am
```javascript
// Program wey use switch statement for day of di week
let dayNumber = 2;
let dayName;
switch (dayNumber) {
case 1:
dayName = "Monday";
break;
case 2:
dayName = "Tuesday";
break;
case 3:
dayName = "Wednesday";
break;
default:
dayName = "Unknown day";
break;
}
console.log(`Today is ${dayName}`);
```
For dis example, JavaScript see say `dayNumber` na `2`, e find `case 2`, set `dayName` to "Tuesday", then break from switch. Result be say "Today is Tuesday" go log for console.
```mermaid
flowchart TD
A["📥 switch(expression)"] --> B["🔍 Check am once"]
B --> C{"Match case 1?"}
C -->|Yes| D["📋 Run case 1"]
C -->|No| E{"Match case 2?"}
E -->|Yes| F["📋 Run case 2"]
E -->|No| G{"Match case 3?"}
G -->|Yes| H["📋 Run case 3"]
G -->|No| I["📋 Run default"]
D --> J["🛑 brake"]
F --> K["🛑 brake"]
H --> L["🛑 brake"]
J --> M["✅ Comot for switch"]
K --> M
L --> M
I --> M
style A fill:#e3f2fd
style B fill:#fff3e0
style M fill:#e8f5e8
```
✅ Test this code and next code by running inside browser console. Change variable a to change returned `console.log()`.
### 🔄 **Switch Statement Mastery: Multiple Options**
**Test your hearing about switch:**
- Wetin go happen if you forget `break` statement?
- When you go use `switch` instead of many `if-else`?
- Why `default` case dey important even if you feel you cover all options?
```mermaid
pie title "When to Use Each Decision Structure"
"Simple if-else" : 40
"Complex if-else chains" : 25
"Switch statements" : 20
"Ternary operators" : 15
```
> **Best practice**: Use `switch` if you dey compare one variable with many specific values. Use `if-else` for range checks or complex conditions!
## Logical Operators and Booleans
Complex decisions need make you check many conditions at once. Just like Boolean algebra dey help mathematicians combine logical expressions, programming dey give logical operators to join many Boolean conditions.
Dis operators dey allow complex conditional logic by joining simple true/false checks.
| Symbol | Description | Example |
| ------ | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
| `&&` | **Logical AND**: Check two Boolean expressions. Returns true **only** if both sides true | `(5 > 3) && (5 < 10) // Both sides are true. Returns true` |
| `\|\|` | **Logical OR**: Check two Boolean expressions. Returns true if at least one side true | `(5 > 10) \|\| (5 < 10) // One side false, the other true. Returns true` |
| `!` | **Logical NOT**: Returns opposite value of Boolean expression | `!(5 > 10) // 5 no bigger than 10, so "!" make am true` |
Dis operators let you join conditions as:
- AND (`&&`) mean both conditions must be true
- OR (`||`) mean at least one condition must be true
- NOT (`!`) turn true to false (and vice versa)
```mermaid
flowchart LR
A["🔗 Logical Operators"] --> B["&& AND"]
A --> C["|| OR"]
A --> D["! NOT"]
B --> B1["Both dem must correct"]
B --> B2["true && true = true"]
B --> B3["true && false = false"]
C --> C1["At least one na true"]
C --> C2["true || false = true"]
C --> C3["false || false = false"]
D --> D1["E change di value"]
D --> D2["!true = false"]
D --> D3["!false = true"]
E["🌍 Real Examples"] --> E1["Age >= 18 && get License"]
E --> E2["na Weekend || na Holiday"]
E --> E3["!no logged in"]
style A fill:#e3f2fd
style B fill:#e8f5e8
style C fill:#fff3e0
style D fill:#f3e5f5
style E fill:#e0f2f1
```
## Conditions and Decisions with Logical Operators
Make we see how logical operators work for real example:
```javascript
let currentMoney = 600;
let laptopPrice = 800;
let laptopDiscountPrice = laptopPrice - (laptopPrice * 0.2); // Laptop price dey for 20 percent off
if (currentMoney >= laptopPrice || currentMoney >= laptopDiscountPrice) {
// Condition true. Code wey dey dis block go run.
console.log("Getting a new laptop!");
} else {
// Condition false. Code wey dey dis block go run.
console.log("Can't afford a new laptop, yet!");
}
```
For dis example: we calculate 20% discount price (640), den check if our money fit pay either full price OR discounted price. Since 600 no reach discounted price 640, condition go be false.
### 🧮 **Logical Operators Check: Combining Conditions**
**Test how you sabi logical operators:**
- For `A && B`, wetin happen if A false? B dey check at all?
- You fit think of situation where you go need all 3 (&&, ||, !) together?
- Wetin be difference between `!user.isActive` and `user.isActive !== true`?
```mermaid
stateDiagram-v2
[*] --> EvaluateA: A && B
EvaluateA --> CheckB: A true
EvaluateA --> ReturnFalse: A no true
CheckB --> ReturnTrue: B true
CheckB --> ReturnFalse: B no true
[*] --> EvaluateC: A || B
EvaluateC --> ReturnTrue: A true
EvaluateC --> CheckD: A no true
CheckD --> ReturnTrue: B true
CheckD --> ReturnFalse: B no true
note right of EvaluateA
Short-circuit evaluation:
If A no true, B no go checked
end note
```
> **Performance tip**: JavaScript get "short-circuit evaluation" - for `A && B`, if A false, B no go check. Use dis sabi well!
### Negation Operator
Sometimes e easier to ask when something NO true. Instead of asking "User don inside?", you fit ask "User NO inside?" Di exclamation mark (`!`) operator dey flip logic.
```javascript
if (!condition) {
// e go run if condition no true
} else {
// e go run if condition true
}
```
`!` operator be like saying "the opposite of..." if something be `true`, `!` go make am `false`, and vice versa.
### Ternary Expressions
For simple conditional assignments, JavaScript get **ternary operator**. Dis short syntax allow you write conditional expression one line. E dey useful when you wan assign either one of two values based on condition.
```javascript
let variable = condition ? returnThisIfTrue : returnThisIfFalse;
```
E read like question: "Dis condition true? If yes, use this. If no, use that."
Below nah more clear example:
```javascript
let firstNumber = 20;
let secondNumber = 10;
let biggestNumber = firstNumber > secondNumber ? firstNumber : secondNumber;
```
✅ Take few minutes read dis code well. You understand how dem dey work?
E talk say: "Is `firstNumber` bigger than `secondNumber`? If yes, put `firstNumber` inside `biggestNumber`. If no, put `secondNumber`."
Ternary operator na short way to write this normal `if..else` statement:
```javascript
let biggestNumber;
if (firstNumber > secondNumber) {
biggestNumber = firstNumber;
} else {
biggestNumber = secondNumber;
}
```
Both ways give same result. Ternary operator sharp and short while regular if-else fit dey easier to read especially for complex conditions.
```mermaid
flowchart LR
A["🤔 Ternary Operator"] --> B["condition ?"]
B --> C["valueIfTrue :"]
C --> D["valueIfFalse"]
E["📝 Traditional If-Else"] --> F["if (condition) {"]
F --> G[" return valueIfTrue"]
G --> H["} else {"]
H --> I[" return valueIfFalse"]
I --> J["}"]
K["⚡ Wen to Use"] --> K1["Simple assignments"]
K --> K2["Short conditions"]
K --> K3["Inline decisions"]
K --> K4["Return statements"]
style A fill:#e3f2fd
style E fill:#fff3e0
style K fill:#e8f5e8
```
---
## 🚀 Challenge
Make you write program wey first use logical operators, then write am again with ternary expression. Which syntax you like pass?
---
## GitHub Copilot Agent Challenge 🚀
Use Agent mode to solve this challenge:
**Description:** Make full grade calculator wey go show many decision-making tech wey we learn for dis lesson, including if-else, switch, logical operators, and ternary expressions.
**Prompt:** Write JavaScript program wey take student numeric score (0-100) and determine their letter grade like dis:
- A: 90-100
- B: 80-89
- C: 70-79
- D: 60-69
- F: Below 60
Requirements:
1. Use if-else statement to determine letter grade
2. Use logical operators to check if di student pass (grade >= 60) AND get honors (grade >= 90)
3. Use switch statement to give specific feedback for each letter grade
4. Use ternary operator to determine if di student fit enter next course (grade >= 70)
5. Include input validation to make sure say di score dey between 0 and 100
Test your program with different scores including edge cases like 59, 60, 89, 90, and invalid inputs.
Learn more about [agent mode](https://code.visualstudio.com/blogs/2025/02/24/introducing-copilot-agent-mode) here.
## Post-Lecture Quiz
[Post-lecture quiz](https://ff-quizzes.netlify.app/web/quiz/12)
## Review & Self Study
Read more about di many operators wey dey available to di user [on MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Operators).
Go through Josh Comeau's fine fine [operator lookup](https://joshwcomeau.com/operator-lookup/)!
## Assignment
[Operators](assignment.md)
---
## 🧠 **Your Decision-Making Toolkit Summary**
```mermaid
graph TD
A["🎯 JavaScript Decisions"] --> B["🔍 Boolean Logic"]
A --> C["📊 Conditional Statements"]
A --> D["🔗 Logical Operators"]
A --> E["⚡ Advanced Patterns"]
B --> B1["true/false values"]
B --> B2["Comparison operators"]
B --> B3["Truthiness concepts"]
C --> C1["if statements"]
C --> C2["if-else chains"]
C --> C3["switch statements"]
D --> D1["&& (AND)"]
D --> D2["|| (OR)"]
D --> D3["! (NOT)"]
E --> E1["Ternary operator"]
E --> E2["Short-circuit evaluation"]
E --> E3["Complex conditions"]
F["💡 Key Principles"] --> F1["Clear readable conditions"]
F --> F2["Consistent comparison style"]
F --> F3["Proper operator precedence"]
F --> F4["Efficient evaluation order"]
style A fill:#e3f2fd
style B fill:#e8f5e8
style C fill:#fff3e0
style D fill:#f3e5f5
style E fill:#e0f2f1
style F fill:#fce4ec
```
---
## 🚀 Your JavaScript Decision-Making Mastery Timeline
### ⚡ **Wetyn You Fit Do Inside Next 5 Minutes**
- [ ] Practice comparison operators for your browser console
- [ ] Write simple if-else statement wey go check your age
- [ ] Try di challenge: rewrite if-else using ternary operator
- [ ] Test wetin dey happen with different "truthy" and "falsy" values
### 🎯 **Wetyn You Fit Achieve Dis Hour**
- [ ] Complete di post-lesson quiz and check any part wey confuse you
- [ ] Build di full grade calculator from di GitHub Copilot challenge
- [ ] Create simple decision tree for real-world situation (like how to choose wetin to wear)
- [ ] Practice to combine multiple conditions with logical operators
- [ ] Experiment with switch statements for different use cases
### 📅 **Your Week-Long Logic Mastery**
- [ ] Complete di operators assignment with creative examples
- [ ] Build mini quiz app using different conditional structures
- [ ] Create form validator wey go check many input conditions
- [ ] Practice Josh Comeau's [operator lookup](https://joshwcomeau.com/operator-lookup/) exercises
- [ ] Refactor your code make e use better conditional structures
- [ ] Study short-circuit evaluation and performance implications
### 🌟 **Your Month-Long Transformation**
- [ ] Master complex nested conditions and keep your code easy to read
- [ ] Build application wey get sophisticated decision-making logic
- [ ] Contribute to open source by improving conditional logic for existing projects
- [ ] Teach person else about different conditional structures and when to use each one
- [ ] Explore functional programming methods for conditional logic
- [ ] Create personal reference guide for conditional best practices
### 🏆 **Final Decision-Making Champion Check-in**
**Celebrate your logical thinking mastery:**
- Wetin be di most complex decision logic wey you don fit implement?
- Which conditional structure you feel dey most natural for you and why?
- How learning about logical operators don change how you dey solve problems?
- Which real-world application go benefit from sophisticated decision-making logic?
```mermaid
journey
title Your Logical Thinking Evolution
section Today
Boolean Wahala: 3: You
If-Else Understanding: 4: You
Operator Recognition: 5: You
section This Week
Complex Conditions: 4: You
Switch Mastery: 5: You
Logical Combinations: 5: You
section Next Month
Advanced Patterns: 5: You
Performance Awareness: 5: You
Teaching Others: 5: You
```
> 🧠 **You don master di art of digital decision-making!** Every interactive application dey rely on conditional logic to respond intelligently to user actions and changing conditions. Now you sabi how to make your programs think, evaluate, and choose correct response. This logical foundation go power every dynamic application wey you build! 🎉
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document na AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator) wey translate am. Even though we dey try make am correct, abeg no forget say automatic translation fit get mistake or no too correct. Di original document wey dey di main language na di correct one. If na serious matter, better make professional human translator do am. We no responsible if any misunderstanding or wrong meaning show because of dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,120 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "ffe366b2d1f037b99fbadbe1dc81083d",
"translation_date": "2026-01-08T12:54:00+00:00",
"source_file": "2-js-basics/3-making-decisions/assignment.md",
"language_code": "pcm"
}
-->
# Making Decisions: Student Grade Processor
## Learning Objectives
For dis assignment, you go practice di decision-making tins wey dis lesson teach by building program wey go process student grades from different grading systems. You go use `if...else` statements, comparison operators, and logical operators to know which students dem pass their courses.
## The Challenge
You dey work for school wey recently merge wit another one. Now you need process student grades from two different grading systems, then find out which students dey pass. Dis na beta chance to practice conditional logic!
### Understanding the Grading Systems
#### First Grading System (Numeric)
- Grades dey as numbers from 1-5
- **Passing grade**: 3 and above (3, 4, or 5)
- **Failing grade**: Below 3 (1 or 2)
#### Second Grading System (Letter Grades)
- Grades dem use letters: `A`, `A-`, `B`, `B-`, `C`, `C-`
- **Passing grades**: `A`, `A-`, `B`, `B-`, `C`, `C-` (all grades listed na passing)
- **Note**: Dis system no get failing grades like `D` or `F`
### Your Task
Given di following array `allStudents` wey represent all students and their grades, build new array `studentsWhoPass` wey go hold all students wey pass according to their correct grading systems.
```javascript
let allStudents = [
'A', // Letta grade - e mean say you pass
'B-', // Letta grade - e mean say you pass
1, // Numɛrik grade - e mean say you fail
4, // Numɛrik grade - e mean say you pass
5, // Numɛrik grade - e mean say you pass
2 // Numɛrik grade - e mean say you fail
];
let studentsWhoPass = [];
```
### Step-by-Step Approach
1. **Set up loop** to check every grade inside di `allStudents` array
2. **Check grade type** (na number or string?)
3. **Apply correct grading system rule**:
- If na number: check if grade >= 3
- If na string: check if e dey among valid passing letter grades
4. **Add passing grades** enter `studentsWhoPass` array
### Helpful Code Techniques
Use dis JavaScript concepts from di lesson:
- **typeof operator**: `typeof grade === 'number'` to check if e be numeric grade
- **Comparison operators**: `>=` to check numeric grades
- **Logical operators**: `||` to check multiple letter grade conditions
- **if...else statements**: to handle different grading systems
- **Array methods**: `.push()` to add passing grades to your new array
### Expected Output
When you run your program, `studentsWhoPass` go get: `['A', 'B-', 4, 5]`
**Why dis grades pass:**
- `'A'` and `'B-'` na valid letter grades (all letter grades for dis system na passing)
- `4` and `5` na numeric grades wey pass >= 3
- `1` and `2` fail because dem numeric grades less than 3
## Testing Your Solution
Test your code with different cases:
```javascript
// Test wit diferent grade kombinéshon dem
let testGrades1 = ['A-', 3, 'C', 1, 'B'];
let testGrades2 = [5, 'A', 2, 'C-', 4];
// Yur solution fọ́ shud wok wit eni kombinéshon of valid grade dem
```
## Bonus Challenges
After you finish di basic assignment, try dis extra ones:
1. **Add validation**: Check for invalid grades (like negative numbers or wrong letters)
2. **Count statistics**: Count how many students pass and how many fail
3. **Grade conversion**: Change all grades to one numeric system (A=5, B=4, C=3, etc.)
## Rubric
| Criteria | Exemplary (4) | Proficient (3) | Developing (2) | Beginning (1) |
|----------|---------------|----------------|----------------|---------------|
| **Functionality** | Program correctly finds all passing grades from both systems | Program work small problem or edge case dey | Program work small small but get logical wahala | Program get serious mistakes or e no run |
| **Code Structure** | Clean, organized code with proper if...else logic | Good structure with correct conditional statements | Acceptable structure but get some organization problems | Bad structure, hard to follow logic |
| **Use of Concepts** | Use well comparison operators, logical operators, and conditional statements | Good use of lesson concepts but slight gap dey | Some use of lesson concepts but miss key parts | Small use of lesson concepts |
| **Problem Solving** | Show clear understanding of di problem and smart solution | Good problem-solving approach with steady logic | Enough problem-solving but some confusion dey | Unclear approach, no show understanding |
## Submission Guidelines
1. **Test your code** good well with di examples given
2. **Add comments** wey explain your logic, especially for di conditional statements
3. **Verify output** match wetin dem expect: `['A', 'B-', 4, 5]`
4. **Think about edge cases** like empty arrays or data wey no expected
> 💡 **Pro Tip**: Start simple! Make di basic functionality work first, then add better features. Remember, di goal na to practice decision-making logic with di tools wey you learn for dis lesson.
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document don translate wit AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator). Even though we dey try make am correct, make you sabi say automated translation fit get errors or mistakes. Di original document wey dey im own language na di real correct source. If na important info, e better to use professional human translation. We no go take responsibility for any misunderstanding or wrong interpretation wey fit come from dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,750 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "1710a50a519a6e4a1b40a5638783018d",
"translation_date": "2026-01-08T12:58:01+00:00",
"source_file": "2-js-basics/4-arrays-loops/README.md",
"language_code": "pcm"
}
-->
# JavaScript Basics: Arrays and Loops
![JavaScript Basics - Arrays](../../../../translated_images/webdev101-js-arrays.439d7528b8a29455.pcm.png)
> Sketchnote by [Tomomi Imura](https://twitter.com/girlie_mac)
```mermaid
journey
title Your Arrays & Loops Adventure
section Array Fundamentals
Creating Arrays: 5: You
Accessing Elements: 4: You
Array Methods: 5: You
section Loop Mastery
For Loops: 4: You
While Loops: 5: You
Modern Syntax: 4: You
section Data Processing
Array + Loops: 5: You
Real-world Applications: 4: You
Performance Optimization: 5: You
```
## Pre-Lecture Quiz
[Pre-lecture quiz](https://ff-quizzes.netlify.app/web/quiz/13)
You don ever wonder how websites dey keep track of the things wey dey for shopping cart or show your friend list? Na di Arrays and loops dey do dis kain work. Arrays be like digital container wey fit hold namba of tins inside, and loops make you fit work with all dis tins quick quick without to dey write same code anyhow.
Together, these two concepts na di foundation for handling info inside your programs. You go learn how to comot for to dey write every step yourself reach to write smart code wey fit process hundreds or thousands of tins swift-quick.
By di end of dis lesson, you go sabi how to do complex data work with just small lines of code. Make we explore these important programming ideas.
[![Arrays](https://img.youtube.com/vi/1U4qTyq02Xw/0.jpg)](https://youtube.com/watch?v=1U4qTyq02Xw "Arrays")
[![Loops](https://img.youtube.com/vi/Eeh7pxtTZ3k/0.jpg)](https://www.youtube.com/watch?v=Eeh7pxtTZ3k "Loops")
> 🎥 Click di pictures wey dey up top for videos about arrays and loops.
> You fit take dis lesson for [Microsoft Learn](https://docs.microsoft.com/learn/modules/web-development-101-arrays/?WT.mc_id=academic-77807-sagibbon)!
```mermaid
mindmap
root((Data Processing))
Arrays
Structure
Square brackets syntax
Zero-based indexing
Dynamic sizing
Operations
push/pop
shift/unshift
indexOf/includes
Types
Numbers array
Strings array
Mixed types
Loops
For Loops
Counting iterations
Array processing
Predictable flow
While Loops
Condition-based
Unknown iterations
User input
Modern Syntax
for...of
forEach
Functional methods
Applications
Data Analysis
Statistics
Filtering
Transformations
User Interfaces
Lists
Menus
Galleries
```
## Arrays
Make you reason arrays like digital filing cabinet - no be say only one paper for one drawer, but you fit put plenty related tins for one organized container. For programming, arrays dey help you store plenty info inside one organized box.
Whether you dey build photo gallery, manage to-do list, or dey keep track of high scores for game, arrays na di foundation for organizing data. Make we see how dem dey work.
✅ Arrays dey everywhere! Fit reason one real-life example of array, like solar panel array?
### Creating Arrays
To create array na easy work - just use square brackets!
```javascript
// Empty array - like empty shopping cart wey dey wait for items
const myArray = [];
```
**Wetin dey happen here?**
You don just create empty container using dem square brackets `[]`. E be like empty shelf for library - e ready to hold any book wey you want put.
You fit also fill your array with initial values from start:
```javascript
// Di flavor dem wey your ice cream shop get
const iceCreamFlavors = ["Chocolate", "Strawberry", "Vanilla", "Pistachio", "Rocky Road"];
// User profile info wey get mix different kain data
const userData = ["John", 25, true, "developer"];
// Test score dem for your best class
const scores = [95, 87, 92, 78, 85];
```
**Cool tins to notice:**
- You fit store text, numbers, or even true/false inside same array
- Just separate each tin with comma - e easy!
- Arrays dey perfect to keep related tins together
```mermaid
flowchart LR
A["📦 Arrays"] --> B["Create [ ]"]
A --> C["Keep Plenty Tin Dem"]
A --> D["Use Index Take Find Am"]
B --> B1["const arr = []"]
B --> B2["const arr = [1,2,3]"]
C --> C1["Numbers"]
C --> C2["Strings"]
C --> C3["Booleans"]
C --> C4["Mixed Types"]
D --> D1["arr[0] = first"]
D --> D2["arr[1] = second"]
D --> D3["arr[2] = third"]
E["📊 Array Index"] --> E1["Index 0: First"]
E --> E2["Index 1: Second"]
E --> E3["Index 2: Third"]
E --> E4["Index n-1: Last"]
style A fill:#e3f2fd
style B fill:#e8f5e8
style C fill:#fff3e0
style D fill:#f3e5f5
style E fill:#e0f2f1
```
### Array Indexing
One tins wey fit surprise you for beginning be say: arrays dey number their tins start from 0, no be 1. Dis zero-based indexing na because how computer memory dey work - e don be programming rule since computer languages like C start. Each position inside array get im own address number wey dem dey call **index**.
| Index | Value | Description |
|-------|-------|-------------|
| 0 | "Chocolate" | First element |
| 1 | "Strawberry" | Second element |
| 2 | "Vanilla" | Third element |
| 3 | "Pistachio" | Fourth element |
| 4 | "Rocky Road" | Fifth element |
✅ E surprise you say arrays start for zero index? For some programming languages, indexes start for 1. E get interesting history about dis, wey you fit [read on Wikipedia](https://en.wikipedia.org/wiki/Zero-based_numbering).
**How to Access Array Elements:**
```javascript
const iceCreamFlavors = ["Chocolate", "Strawberry", "Vanilla", "Pistachio", "Rocky Road"];
// Access each item wit bracket notation
console.log(iceCreamFlavors[0]); // "Chocolate" - first item
console.log(iceCreamFlavors[2]); // "Vanilla" - third item
console.log(iceCreamFlavors[4]); // "Rocky Road" - last item
```
**Wetin dey happen here:**
- **Use** square bracket notation plus index number to access elements
- **Return** value wey dey for that position inside array
- **Start** counting from 0, so first element get index 0
**How to Modify Array Elements:**
```javascript
// Change one value wey don dey
iceCreamFlavors[4] = "Butter Pecan";
console.log(iceCreamFlavors[4]); // "Butter Pecan"
// Add new thing for the end
iceCreamFlavors[5] = "Cookie Dough";
console.log(iceCreamFlavors[5]); // "Cookie Dough"
```
**For di example wey pass:**
- **Change** di element wey get index 4 from "Rocky Road" to "Butter Pecan"
- **Add** new element "Cookie Dough" at index 5
- **Extend** array automatically when you add items pass current size
### Array Length and Common Methods
Arrays get built-in properties and methods wey make work with data easy.
**How to Find Array Length:**
```javascript
const iceCreamFlavors = ["Chocolate", "Strawberry", "Vanilla", "Pistachio", "Rocky Road"];
console.log(iceCreamFlavors.length); // 5
// Length go update by itself as array dey change
iceCreamFlavors.push("Mint Chip");
console.log(iceCreamFlavors.length); // 6
```
**Key points:**
- **Return** total number of elements inside array
- **Update** automatically when you add or remove elements
- **Give** dynamic count wey fit help for loops and validation
**Important Array Methods:**
```javascript
const fruits = ["apple", "banana", "orange"];
// Add elements
fruits.push("grape"); // Adds to end: ["apple", "banana", "orange", "grape"]
fruits.unshift("strawberry"); // Adds to beginning: ["strawberry", "apple", "banana", "orange", "grape"]
// Remove elements
const lastFruit = fruits.pop(); // Removes and returns "grape"
const firstFruit = fruits.shift(); // Removes and returns "strawberry"
// Find elements
const index = fruits.indexOf("banana"); // Returns 1 (position of "banana")
const hasApple = fruits.includes("apple"); // Returns true
```
**Wetin these methods dey do:**
- **Add** elements with `push()` (for end) and `unshift()` (for beginning)
- **Remove** elements with `pop()` (for end) and `shift()` (for beginning)
- **Find** elements with `indexOf()` and check if dey with `includes()`
- **Return** useful values like removed elements or position indexes
✅ Try am yourself! Use your browser console to create and manipulate array wey you create.
### 🧠 **Array Fundamentals Check: Organize Your Data**
**Test your understanding of array:**
- Why you think say arrays dey start counting from 0, no be 1?
- Wetin happen if you try to access index wey no dey (like `arr[100]` for array wey get 5 elements)?
- Fit give three real-world examples where arrays go useful?
```mermaid
stateDiagram-v2
[*] --> EmptyArray: const arr = []
EmptyArray --> WithItems: Add elements
WithItems --> Accessing: Use indexes
Accessing --> Modifying: Change values
Modifying --> Processing: Use methods
WithItems --> WithItems: push(), unshift()
Processing --> Processing: pop(), shift()
note right of Accessing
Zero-based indexing
arr[0] = first element
end note
note right of Processing
Built-in methods
Dynamic operations
end note
```
> **Real-world insight**: Arrays everywhere for programming! Social media feeds, shopping carts, photo galleries, playlist songs - all na arrays for back ground!
## Loops
Think of the famous punishment from Charles Dickens' novels where students had to write lines repeatedly on a slate. Imagine if you fit just tell person say "write dis sentence 100 times" and e go do am automatically. Na dis loops dey do for your code.
Loops be like tireless assistant wey fit repeat work without make mistake. Whether you want check all items wey dey inside shopping cart or show all pictures for album, loops fit repeat well well.
JavaScript get plenty kinds of loops. Make we check each one and understand when to use am.
```mermaid
flowchart TD
A["🔄 Kain Loops"] --> B["For Loop"]
A --> C["While Loop"]
A --> D["For...of Loop"]
A --> E["forEach Method"]
B --> B1["Di amount dem sabi"]
B --> B2["Based on counter"]
B --> B3["for(init; condition; increment)"]
C --> C1["Di amount dem no sabi"]
C --> C2["Based on condition"]
C --> C3["while(condition)"]
D --> D1["Modern ES6+"]
D --> D2["Array ting"]
D --> D3["for(item of array)"]
E --> E1["Functional style"]
E --> E2["Array method"]
E --> E3["array.forEach(callback)"]
F["⏰ Wen to Use"] --> F1["For: Counting, indexes"]
F --> F2["While: User input, searching"]
F --> F3["For...of: Simple iteration"]
F --> F4["forEach: Functional programming"]
style A fill:#e3f2fd
style B fill:#e8f5e8
style C fill:#fff3e0
style D fill:#f3e5f5
style E fill:#e0f2f1
style F fill:#fce4ec
```
### For Loop
The `for` loop be like to set timer - you sabi exactly how many times you want make tins happen. E dey organized and predictable, so e perfect if you dey work with arrays or you want count tins.
**For Loop Structure:**
| Component | Purpose | Example |
|-----------|---------|----------|
| **Initialization** | Sets starting point | `let i = 0` |
| **Condition** | When to continue | `i < 10` |
| **Increment** | How to update | `i++` |
```javascript
// Counting from 0 to 9
for (let i = 0; i < 10; i++) {
console.log(`Count: ${i}`);
}
// More practical example: processing scores
const testScores = [85, 92, 78, 96, 88];
for (let i = 0; i < testScores.length; i++) {
console.log(`Student ${i + 1}: ${testScores[i]}%`);
}
```
**Step by step, wetin dey happen:**
- **Start** counter variable `i` to 0
- **Check** `i < 10` before every loop
- **Run** di code block if condition true
- **Increment** `i` by 1 after each loop with `i++`
- **Stop** when `i` reach 10 (condition no longer true)
✅ Run dis code for browser console. Wetin happen if you change counter, condition, or increment? Fit make am run backwards and make countdown?
### 🗓️ **For Loop Mastery Check: Controlled Repetition**
**Test your knowledge on for loop:**
- Wetin be the three parts of for loop and wetin each one dey do?
- How you go loop through array backwards?
- Wetin happen if you forget increment part (`i++`)?
```mermaid
flowchart TD
A["🚀 Start For Loop"] --> B["Initialize: let i = 0"]
B --> C{"Condition: i < array.length?"}
C -->|true| D["Run di code block"]
D --> E["Increment: i++"]
E --> C
C -->|false| F["✅ Comot for loop"]
G["📋 Common Patterns"] --> G1["for(let i=0; i<n; i++)"]
G --> G2["for(let i=n-1; i>=0; i--)"]
G --> G3["for(let i=0; i<arr.length; i+=2)"]
style A fill:#e3f2fd
style F fill:#e8f5e8
style G fill:#fff3e0
```
> **Loop wisdom**: For loops dey perfect when you know how many times you go repeat tin. Na di most common choice for array processing!
### While Loop
The `while` loop mean say "keep doing dis until..." - you no too sure how many times e go run, but you sabi when to stop. E dey perfect for tins like to dey ask user for input until dem give you the correct answer, or search data until you find wetin you dey find.
**While Loop Characteristics:**
- **Keep running** as long as condition true
- **You must** manage counter yourself
- **Check** condition before each iteration
- **Fit cause** infinite loop if condition no ever become false
```javascript
// Basic counting example
let i = 0;
while (i < 10) {
console.log(`While count: ${i}`);
i++; // No forget to add one!
}
// More practical example: processing user input
let userInput = "";
let attempts = 0;
const maxAttempts = 3;
while (userInput !== "quit" && attempts < maxAttempts) {
userInput = prompt(`Enter 'quit' to exit (attempt ${attempts + 1}):`);
attempts++;
}
if (attempts >= maxAttempts) {
console.log("Maximum attempts reached!");
}
```
**Understanding examples:**
- **Manage** `i` counter inside loop yourself
- **Increment** counter make e no run forever
- **Show** practical example with user input and try limit
- **Include** safety checks to prevent infinite loops
### ♾️ **While Loop Wisdom Check: Condition-Based Repetition**
**Test your understanding:**
- Wetin be main danger wey dey while loops?
- When you go choose while loop instead of for loop?
- How you fit stop infinite loops?
```mermaid
flowchart LR
A["🔄 While vs For"] --> B["While Loop"]
A --> C["For Loop"]
B --> B1["No sabi how many times e go run"]
B --> B2["Condition dey control am"]
B --> B3["User input, di search ting"]
B --> B4["⚠️ Wahala: e fit run no stop"]
C --> C1["Sabi how many times e go run"]
C --> C2["Counter dey control am"]
C --> C3["Array processing"]
C --> C4["✅ Safe: e sure say e go finish"]
D["🛡️ Safety Tips"] --> D1["Always change di condition variable"]
D --> D2["Make sure get way to comot for am"]
D --> D3["Set maximum times wey e fit run"]
style A fill:#e3f2fd
style B fill:#fff3e0
style C fill:#e8f5e8
style D fill:#ffebee
```
> **Safety first**: While loops strong but you need careful to manage condition well. Always make sure your loop condition go eventually become false!
### Modern Loop Alternatives
JavaScript get modern loop syntax wey go make your code clear and reduce mistakes.
**For...of Loop (ES6+):**
```javascript
const colors = ["red", "green", "blue", "yellow"];
// Modern way - cleaner and safer
for (const color of colors) {
console.log(`Color: ${color}`);
}
// Compare wit traditional for loop
for (let i = 0; i < colors.length; i++) {
console.log(`Color: ${colors[i]}`);
}
```
**Advantages of for...of:**
- **No need** to manage index or worry about off-by-one errors
- **Directly** access each array element
- **Make code** easier to read and less complex
**forEach Method:**
```javascript
const prices = [9.99, 15.50, 22.75, 8.25];
// Dey use forEach for functional programming style
prices.forEach((price, index) => {
console.log(`Item ${index + 1}: $${price.toFixed(2)}`);
});
// forEach with arrow functions for simple operations
prices.forEach(price => console.log(`Price: $${price}`));
```
**What you need know about forEach:**
- **Run** function for each array element
- **Pass** element value and index as arguments
- **No fit** break early (unlike normal loops)
- **Return** undefined (no create new array)
✅ Why you go choose for loop vs. while loop? 17K people for StackOverflow ask this question, and some opinions [fit interest you](https://stackoverflow.com/questions/39969145/while-loops-vs-for-loops-in-javascript).
### 🎨 **Modern Loop Syntax Check: Gettin Used to ES6+**
**Check your modern JavaScript knowledge:**
- Wetin be advantages of `for...of` over traditional for loops?
- When you fit still prefer traditional for loops?
- Wetin be di difference between `forEach` and `map`?
```mermaid
quadrantChart
title Loop Selection Guide
x-axis Traditional --> Modern
y-axis Simple --> Complex
quadrant-1 Modern Complex
quadrant-2 Traditional Complex
quadrant-3 Traditional Simple
quadrant-4 Modern Simple
Traditional For: [0.2, 0.7]
While Loop: [0.3, 0.6]
For...of: [0.8, 0.3]
forEach: [0.9, 0.4]
Array Methods: [0.8, 0.8]
```
> **Modern trend**: ES6+ syntax like `for...of` and `forEach` dey become preferred way for array iteration because e clean and less error-prone!
## Loops and Arrays
If you combine arrays and loops, you get powerful way to process data. This pairing important well well for plenty programming tasks, from showing lists to calculating statistics.
**Traditional Array Processing:**
```javascript
const iceCreamFlavors = ["Chocolate", "Strawberry", "Vanilla", "Pistachio", "Rocky Road"];
// Classic for loop way
for (let i = 0; i < iceCreamFlavors.length; i++) {
console.log(`Flavor ${i + 1}: ${iceCreamFlavors[i]}`);
}
// Modern for...of way
for (const flavor of iceCreamFlavors) {
console.log(`Available flavor: ${flavor}`);
}
```
**Understand this approach:**
- **Use** array length to control loop limit
- **Access** elements by index in normal for loops
- **Get** element direct in for...of loops
- **Process** each element exactly once
**Example for Data Processing:**
```javascript
const studentGrades = [85, 92, 78, 96, 88, 73, 89];
let total = 0;
let highestGrade = studentGrades[0];
let lowestGrade = studentGrades[0];
// Process all di grades wit one loop only
for (let i = 0; i < studentGrades.length; i++) {
const grade = studentGrades[i];
total += grade;
if (grade > highestGrade) {
highestGrade = grade;
}
if (grade < lowestGrade) {
lowestGrade = grade;
}
}
const average = total / studentGrades.length;
console.log(`Average: ${average.toFixed(1)}`);
console.log(`Highest: ${highestGrade}`);
console.log(`Lowest: ${lowestGrade}`);
```
**How this code dey work:**
- **Start** variables to keep sum and extreme values
- **Loop** through each grade once efficiently
- **Add up** total for average calculation
- **Keep track** of highest and lowest grade while looping
- **Calculate** final stats after loop finish
✅ Try to loop your own created array for browser console.
```mermaid
flowchart TD
A["📦 Array Data"] --> B["🔄 Loop Processing"]
B --> C["📈 Results"]
A1["[85, 92, 78, 96, 88]"] --> A
B --> B1["Calculate total"]
B --> B2["Find min/max"]
B --> B3["Count conditions"]
B --> B4["Transform data"]
C --> C1["Average: 87.8"]
C --> C2["Highest: 96"]
C --> C3["Passing: 5/5"]
C --> C4["Letter grades"]
D["⚡ Processing Patterns"] --> D1["Accumulation (sum)"]
D --> D2["Comparison (min/max)"]
D --> D3["Filtering (conditions)"]
D --> D4["Mapping (transformation)"]
style A fill:#e3f2fd
style B fill:#fff3e0
style C fill:#e8f5e8
style D fill:#f3e5f5
```
---
## GitHub Copilot Agent Challenge 🚀
Use Agent mode make you complete this challenge:
**Description:** Build one correct function wey combine arrays and loops to analyze dataset and generate good insights.
**Prompt:** Create function wey dey call `analyzeGrades` wey takes array of student grade objects (each get name and score properties) and returns object with stats like highest score, lowest score, average score, count of students wey pass (score >= 70), and array of student names wey score pass average. Use at least two different loop types for your solution.
Learn more about [agent mode](https://code.visualstudio.com/blogs/2025/02/24/introducing-copilot-agent-mode) here.
## 🚀 Challenge
JavaScript get plenti modern array methods we fit take replace old-style loops for some kain tasks. Make you check [forEach](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach), [for-of](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/for...of), [map](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/map), [filter](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/filter), and [reduce](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce).
**Your challenge:** Change the student grades example make e use at least three different array methods. You go see how the code go clean well and easy to read as you use modern JavaScript syntax.
## Post-Lecture Quiz
[Post-lecture quiz](https://ff-quizzes.netlify.app/web/quiz/14)
## Review & Self Study
Arrays for JavaScript get plenty methods wey dey attached to dem, wey sharp wella for data manipulation. [Read up on these methods](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) and try some of dem out (like push, pop, slice and splice) on an array wey you create yourself.
## Assignment
[Loop an Array](assignment.md)
---
## 📊 **Your Arrays & Loops Toolkit Summary**
```mermaid
graph TD
A["🎯 Arrays & Loops Mastary"] --> B["📦 Array Fundamentals"]
A --> C["🔄 Loop Kra"]
A --> D["🔗 Data Wok"]
A --> E["🎨 New Technik Dem"]
B --> B1["Creation: [ ]"]
B --> B2["Indexing: arr[0]"]
B --> B3["Method Dem: push, pop"]
B --> B4["Property Dem: length"]
C --> C1["For: We Know How Many"]
C --> C2["While: Based on Condition"]
C --> C3["For...of: Direct Access"]
C --> C4["forEach: Functional"]
D --> D1["Statistics Calculation"]
D --> D2["Data Change Work"]
D --> D3["Filtering & Searching"]
D --> D4["Real-time Processing"]
E --> E1["Arrow Function Dem"]
E --> E2["Method Chaining"]
E --> E3["Destructuring"]
E --> E4["Template Literals"]
F["💡 Key Benefit Dem"] --> F1["Better Data Handling"]
F --> F2["Less Code Repeat"]
F --> F3["Solution Dem Wey Fit Grow"]
F --> F4["Clean Syntax"]
style A fill:#e3f2fd
style B fill:#e8f5e8
style C fill:#fff3e0
style D fill:#f3e5f5
style E fill:#e0f2f1
style F fill:#fce4ec
```
---
## 🚀 Your Arrays & Loops Mastery Timeline
### ⚡ **What You Can Do in the Next 5 Minutes**
- [ ] Create array of your favorite movies and check specific elements
- [ ] Write for loop wey go count from 1 reach 10
- [ ] Try the modern array methods challenge from the lesson
- [ ] Practice array indexing for your browser console
### 🎯 **What You Can Accomplish This Hour**
- [ ] Finish the post-lesson quiz and review any tricky palava
- [ ] Build the full grade analyzer from the GitHub Copilot challenge
- [ ] Make simple shopping cart wey go add and remove items
- [ ] Practice changing between different loop types
- [ ] Experiment with array methods like `push`, `pop`, `slice`, and `splice`
### 📅 **Your Week-Long Data Processing Journey**
- [ ] Finish the "Loop an Array" assignment with creative upgrades
- [ ] Build to-do list app wey use arrays and loops
- [ ] Make simple statistics calculator for number data
- [ ] Practice with [MDN array methods](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)
- [ ] Build photo gallery or music playlist interface
- [ ] Explore functional programming with `map`, `filter`, and `reduce`
### 🌟 **Your Month-Long Transformation**
- [ ] Master advanced array operations and make dem fast
- [ ] Build full data visualization dashboard
- [ ] Join open source projects wey get data processing
- [ ] Teach somebody about arrays and loops with real examples
- [ ] Build personal library of reusable data processing functions
- [ ] Explore algorithms and data structures wey dey based on arrays
### 🏆 **Final Data Processing Champion Check-in**
**Celebrate your array and loop mastery:**
- Wetin be the most useful array operation wey you don learn for real-world work?
- Which kind loop you feel most natural for you and why?
- How understanding arrays and loops don change how you dey arrange data?
- Which complex data processing work you go like try next?
```mermaid
journey
title Your Data Processing Evolution
section Today
Array Confusion: 3: You
Loop Basics: 4: You
Index Understanding: 5: You
section This Week
Method Mastery: 4: You
Efficient Processing: 5: You
Modern Syntax: 5: You
section Next Month
Complex Algorithms: 5: You
Performance Optimization: 5: You
Teaching Others: 5: You
```
> 📦 **You don unlock the power to organise and process data!** Arrays and loops be the foundation for nearly every app wey you go build. From simple lists to complex data analysis, you get the tools to handle information sharp-sharp and well. Every dynamic website, mobile app, and data-driven application dey depend on these basic concepts. Welcome to the world of big-big data processing! 🎉
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document na AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator) wey translate am. Even though we try make am correct, abeg sabi say machine translation fit get mistake or no too correct. The original document wey dey the main language na the correct one. If na serious matter, e good make human translator translate am. We no go carry any blame if person no understand or if e misinterpret anything wey come from dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,124 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "8abcada0534e0fb3a7556ea3c5a2a8a4",
"translation_date": "2026-01-08T13:08:57+00:00",
"source_file": "2-js-basics/4-arrays-loops/assignment.md",
"language_code": "pcm"
}
-->
# Arrays and Loops Assignment
## Instructions
Complete di following exercises to practice working wit arrays and loops. Each exercise build on concepts from di lesson and encourage you to apply different loop types and array methods.
### Exercise 1: Number Pattern Generator
Create one program wey go list every 3rd number between 1-20 and print am to di console.
**Requirements:**
- Use one `for` loop wit custom increment
- Display numbers for user-friendly format
- Add descriptive comments wey go explain your logic
**Expected Output:**
```
3, 6, 9, 12, 15, 18
```
> **Tip:** Modify di iteration-expression for your for loop make e skip numbers.
### Exercise 2: Array Analysis
Create one array of at least 8 different numbers and write functions to analyze di data.
**Requirements:**
- Create one array wey dem go call `numbers` with at least 8 values
- Write one function `findMaximum()` wey go return di highest number
- Write one function `findMinimum()` wey go return di lowest number
- Write one function `calculateSum()` wey go return di total of all numbers
- Test each function and show di results
**Bonus Challenge:** Create one function wey go find di second highest number inside di array.
### Exercise 3: String Array Processing
Create one array of your favorite movies/books/songs and practice different loop types.
**Requirements:**
- Create one array wit at least 5 string values
- Use traditional `for` loop to show items with numbers (1. Item Name)
- Use `for...of` loop to show items for uppercase
- Use `forEach()` method to count and show di total characters
**Example Output:**
```
Traditional for loop:
1. The Matrix
2. Inception
3. Interstellar
For...of loop (uppercase):
THE MATRIX
INCEPTION
INTERSTELLAR
Character count:
Total characters across all titles: 42
```
### Exercise 4: Data Filtering (Advanced)
Create one program wey go process array of objects wey represent students.
**Requirements:**
- Create one array of at least 5 student objects with properties: `name`, `age`, `grade`
- Use loops to find students wey be 18 or older
- Calculate di average grade of all students
- Create new array wey go contain only students wey get grades above 85
**Example Structure:**
```javascript
const students = [
{ name: "Alice", age: 17, grade: 92 },
{ name: "Bob", age: 18, grade: 84 },
// Add more pikin dem...
];
```
## Testing Your Code
Test your programs by:
1. Running each exercise inside your browser console
2. Check outputs make sure dem match di expected results
3. Test wit different data sets
4. Check say your code fit handle edge cases (empty arrays, single elements)
## Submission Guidelines
Include di following inside your submission:
- Well-commented JavaScript code for each exercise
- Screenshots or text output wey show your programs dey run
- Small explanation of which loop type you choose for each task and why
## Rubric
| Criteria | Exemplary (3 points) | Adequate (2 points) | Needs Improvement (1 point) |
| -------- | -------------------- | ------------------- | --------------------------- |
| **Functionality** | All exercises complete correctly wit bonus challenges | All required exercises dey work correctly | Some exercises no complete or get errors |
| **Code Quality** | Clean, well-organized code wit descriptive variable names | Code dey work but fit be cleaner | Code messy or e hard to understand |
| **Comments** | Comprehensive comments wey explain logic and decisions | Basic comments dey present | Small or no comments |
| **Loop Usage** | Shows understanding of different loop types well | Use loops correctly but no variety | Wrong or inefficient loop usage |
| **Testing** | Proof of thorough testing wit plenty scenarios | Basic testing dey done | No much evidence of testing |
## Reflection Questions
After you finish di exercises, think about:
1. Which type of loop you enjoy use pass and why?
2. Wetin challenge you when you dey work wit arrays?
3. How these skills fit help you for real-world web development projects?
4. Wetin you for do different if you gots to optimize your code for better performance?
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document don translate wit AI translation service wey dem dey call [Co-op Translator](https://github.com/Azure/co-op-translator). Even though we try make am correct, abeg make you sabi say automated translation fit get some errors or wahala. Di original document wey dem write for im own language na im be correct source. If na important info, better make professional human translation do am. We no go take responsibility if mistake or misunderstanding happen because of dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,30 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "cc9e70a2f096c67389c8acff1521fc27",
"translation_date": "2026-01-08T10:44:35+00:00",
"source_file": "2-js-basics/README.md",
"language_code": "pcm"
}
-->
# Introduction to JavaScript
JavaScript na di language wey web dey use. For dis four lessons, you go learn im basics.
### Topics
1. [Variables and Data Types](1-data-types/README.md)
2. [Functions and Methods](2-functions-methods/README.md)
3. [Making Decisions with JavaScript](3-making-decisions/README.md)
4. [Arrays and Loops](4-arrays-loops/README.md)
### Credits
Dem write dis lessons with ♥️ by [Jasmine Greenaway](https://twitter.com/paladique), [Christopher Harrison](https://twitter.com/geektrainer) and [Chris Noring](https://twitter.com/chris_noring)
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document don translate wit AI translation service wey dem dey call [Co-op Translator](https://github.com/Azure/co-op-translator). Even tho we dey try make am correct, abeg no forget say sometimes automated translation fit get mistake or no too correct. The original document wey dem write for im own language na im get correct info pass. If na important info, e better make professional human translator do am. We no go take any kasala or wahala wey fit come from how dis translation dem use.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,594 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "3fcfa99c4897e051b558b5eaf1e8cc74",
"translation_date": "2026-01-08T18:29:33+00:00",
"source_file": "3-terrarium/1-intro-to-html/README.md",
"language_code": "pcm"
}
-->
# Terrarium Project Part 1: Introduction to HTML
```mermaid
journey
title Your HTML Learning Journey
section Foundation
Create HTML file: 3: Student
Add DOCTYPE: 4: Student
Structure document: 5: Student
section Content
Add metadata: 4: Student
Include images: 5: Student
Organize layout: 5: Student
section Semantics
Use proper tags: 4: Student
Enhance accessibility: 5: Student
Build terrarium: 5: Student
```
![Introduction to HTML](../../../../translated_images/webdev101-html.4389c2067af68e98.pcm.png)
> Sketchnote by [Tomomi Imura](https://twitter.com/girlie_mac)
HTML, or HyperText Markup Language, na di foundation of every website wey you don ever visit. Think of HTML as di skeleton wey dey give structure to web pages e dey define where content go, how e dey organized, and wetin each piece mean. While CSS go later "dress up" your HTML with colors and layouts, and JavaScript go bring am to life wit interactivity, HTML na di essential structure wey dey make everything else possible.
For dis lesson, you go create di HTML structure for virtual terrarium interface. Dis hands-on project go teach you fundamental HTML concepts while you dey build something wey go dey visually engaging. You go learn how to organize content using semantic elements, work wit images, and create di foundation for interactive web application.
By di end of dis lesson, you go get working HTML page wey dey show plant images for organized columns, ready for styling for di next lesson. No worry if e look basic at first na exactly wetin HTML suppose do before CSS add di visual polish.
```mermaid
mindmap
root((HTML Fundamentals))
Structure
DOCTYPE Declaration
HTML Element
Head Section
Body Content
Elements
Tags & Attributes
Self-closing Tags
Nested Elements
Block vs Inline
Content
Text Elements
Images
Containers (div)
Lists
Semantics
Meaningful Tags
Accessibility
Screen Readers
SEO Benefits
Best Practices
Proper Nesting
Valid Markup
Descriptive Alt Text
Organized Structure
```
## Pre-Lecture Quiz
[Pre-lecture quiz](https://ff-quizzes.netlify.app/web/quiz/15)
> 📺 **Watch and Learn**: Check out dis helpful video overview
>
> [![HTML Fundamentals Video](https://img.youtube.com/vi/1TvxJKBzhyQ/0.jpg)](https://www.youtube.com/watch?v=1TvxJKBzhyQ)
## Setting Up Your Project
Before we dive into HTML code, mek we set up proper workspace for your terrarium project. Creating organized file structure from di beginning na important habit wey go serve you well throughout your web development journey.
### Task: Create Your Project Structure
You go create dedicated folder for your terrarium project and add your first HTML file. Here be two approaches wey you fit use:
**Option 1: Using Visual Studio Code**
1. Open Visual Studio Code
2. Click "File" → "Open Folder" or use `Ctrl+K, Ctrl+O` (Windows/Linux) or `Cmd+K, Cmd+O` (Mac)
3. Create new folder wey dem name `terrarium` and select am
4. For Explorer pane, click "New File" icon
5. Name your file `index.html`
![VS Code Explorer showing new file creation](../../../../translated_images/vs-code-index.e2986cf919471eb9.pcm.png)
**Option 2: Using Terminal Commands**
```bash
mkdir terrarium
cd terrarium
touch index.html
code index.html
```
**Here na wetin these commands dey do:**
- **Creates** new directory wey dem name `terrarium` for your project
- **Navigates** inside di terrarium directory
- **Creates** empty `index.html` file
- **Opens** di file for Visual Studio Code make you fit edit
> 💡 **Pro Tip**: Di filename `index.html` special for web development. When person visit website, browsers dey automatically look for `index.html` as di default page wey dem go show. Dis mean URL like `https://mysite.com/projects/` go automatically serve di `index.html` file from `projects` folder without you needing to specify di filename for di URL.
## Understanding HTML Document Structure
Every HTML document follow specific structure wey browsers need to understand and display well. Think of dis structure like formal letter e get required elements for particular order wey dey help di recipient (na di browser) process di content well.
```mermaid
flowchart TD
A["<!DOCTYPE html>"] --> B["<html>"]
B --> C["<head>"]
C --> D["<title>"]
C --> E["<meta charset>"]
C --> F["<meta viewport>"]
B --> G["<body>"]
G --> H["<h1> Hed"]
G --> I["<div> Kontena dem"]
G --> J["<img> Picha dem"]
style A fill:#e1f5fe
style B fill:#f3e5f5
style C fill:#fff3e0
style G fill:#e8f5e8
```
Make we start by adding di essential foundation wey every HTML document need.
### The DOCTYPE Declaration and Root Element
Di first two lines of any HTML file na di document's "introduction" to di browser:
```html
<!DOCTYPE html>
<html></html>
```
**Understanding wetin dis code dey do:**
- **Declares** di document type as HTML5 using `<!DOCTYPE html>`
- **Creates** di root `<html>` element wey go contain all page content
- **Establishes** modern web standards for proper browser rendering
- **Ensures** consistent display across different browsers and devices
> 💡 **VS Code Tip**: Hover over any HTML tag for VS Code to see helpful information from MDN Web Docs, including usage examples and browser compatibility details.
> 📚 **Learn More**: Di DOCTYPE declaration dey stop browsers from entering "quirks mode," wey dem dey use to support very old websites. Modern web development use simple `<!DOCTYPE html>` declaration to ensure [standards-compliant rendering](https://developer.mozilla.org/docs/Web/HTML/Quirks_Mode_and_Standards_Mode).
### 🔄 **Pedagogical Check-in**
**Pause and Reflect**: Before you continue, make sure say you understand:
- ✅ Why every HTML document need DOCTYPE declaration
- ✅ Wetin di `<html>` root element contain
- ✅ How dis structure dey help browsers render pages well
**Quick Self-Test**: Fit explain with your own words wetin "standards-compliant rendering" mean?
## Adding Essential Document Metadata
Di `<head>` section of HTML document get important information wey browsers and search engines need, but visitors no dey see am directly on di page. Think am as "behind-the-scenes" info wey help your webpage work well and show correctly across different devices and platforms.
Dis metadata dey tell browsers how to display your page, wetin character encoding to use, and how to handle different screen sizes all na important for creating professional, accessible web pages.
### Task: Add the Document Head
Put dis `<head>` section between your opening and closing `<html>` tags:
```html
<head>
<title>Welcome to my Virtual Terrarium</title>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
```
**Breaking down wetin each element dey do:**
- **Sets** di page title wey go show for browser tabs and search results
- **Specifies** UTF-8 character encoding for proper text display around di world
- **Ensures** compatibility with modern versions of Internet Explorer
- **Configures** responsive design by setting di viewport to match device width
- **Controls** initial zoom level make content show normally
> 🤔 **Think About This**: Wetin go happen if you set viewport meta tag like dis: `<meta name="viewport" content="width=600">`? Dis one go force di page to always be 600 pixels wide, and e go spoil responsive design! Learn more about [proper viewport configuration](https://developer.mozilla.org/docs/Web/HTML/Viewport_meta_tag).
## Building the Document Body
Di `<body>` element get all di visible content of your webpage everything wey users go see and interact with. While di `<head>` section dey give instructions to di browser, di `<body>` section get di actual content: text, images, buttons, and other elements wey go create your user interface.
Make we add body structure and understand how HTML tags dey work together to create meaningful content.
### Understanding HTML Tag Structure
HTML dey use paired tags to define elements. Most tags get opening tag like `<p>` and closing tag like `</p>`, with content inside: `<p>Hello, world!</p>`. Dis one create paragraph element wey contain di text "Hello, world!".
### Task: Add the Body Element
Update your HTML file to include di `<body>` element:
```html
<!DOCTYPE html>
<html>
<head>
<title>Welcome to my Virtual Terrarium</title>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body></body>
</html>
```
**Here na wetin dis complete structure dey provide:**
- **Establishes** di basic HTML5 document framework
- **Includes** important metadata for proper browser rendering
- **Creates** empty body ready for your visible content
- **Follows** modern web development best practices
Now you ready to add di visible elements of your terrarium. We go use `<div>` elements as containers to organize different sections of content, and `<img>` elements to show di plant images.
### Working with Images and Layout Containers
Images special for HTML because dem dey use "self-closing" tags. Unlike elements like `<p></p>` wey dey wrap content, di `<img>` tag contain all info e need inside di tag itself using attributes like `src` for di image file path and `alt` for accessibility.
Before you add images to your HTML, you gats organize your project files well by creating images folder and adding di plant graphics.
**First, set up your images:**
1. Create folder wey dem call `images` inside your terrarium project folder
2. Download di plant images from [solution folder](../../../../3-terrarium/solution/images) (14 plant images total)
3. Copy all di plant images enter your new `images` folder
### Task: Create the Plant Display Layout
Now add di plant images organized in two columns between your `<body></body>` tags:
```html
<div id="page">
<div id="left-container" class="container">
<div class="plant-holder">
<img class="plant" alt="plant" id="plant1" src="../../../../translated_images/plant1.d87946a2ca70cc43.pcm.png" />
</div>
<div class="plant-holder">
<img class="plant" alt="plant" id="plant2" src="../../../../translated_images/plant2.8daa1606c9c1ad89.pcm.png" />
</div>
<div class="plant-holder">
<img class="plant" alt="plant" id="plant3" src="../../../../translated_images/plant3.8b0d484381a2a2a7.pcm.png" />
</div>
<div class="plant-holder">
<img class="plant" alt="plant" id="plant4" src="../../../../translated_images/plant4.656e16ae1df37be2.pcm.png" />
</div>
<div class="plant-holder">
<img class="plant" alt="plant" id="plant5" src="../../../../translated_images/plant5.2b41b9355f11ebcc.pcm.png" />
</div>
<div class="plant-holder">
<img class="plant" alt="plant" id="plant6" src="../../../../translated_images/plant6.3d1827d03b656994.pcm.png" />
</div>
<div class="plant-holder">
<img class="plant" alt="plant" id="plant7" src="../../../../translated_images/plant7.8152c302ac97f621.pcm.png" />
</div>
</div>
<div id="right-container" class="container">
<div class="plant-holder">
<img class="plant" alt="plant" id="plant8" src="../../../../translated_images/plant8.38d6428174ffa850.pcm.png" />
</div>
<div class="plant-holder">
<img class="plant" alt="plant" id="plant9" src="../../../../translated_images/plant9.f0e38d3327c37fc2.pcm.png" />
</div>
<div class="plant-holder">
<img class="plant" alt="plant" id="plant10" src="../../../../translated_images/plant10.b159d6d6e985595f.pcm.png" />
</div>
<div class="plant-holder">
<img class="plant" alt="plant" id="plant11" src="../../../../translated_images/plant11.2a03a1c2ec8ea84e.pcm.png" />
</div>
<div class="plant-holder">
<img class="plant" alt="plant" id="plant12" src="../../../../translated_images/plant12.60e9b53e538fbaf3.pcm.png" />
</div>
<div class="plant-holder">
<img class="plant" alt="plant" id="plant13" src="../../../../translated_images/plant13.07a51543c820bcf5.pcm.png" />
</div>
<div class="plant-holder">
<img class="plant" alt="plant" id="plant14" src="../../../../translated_images/plant14.6e486371ba7d36ba.pcm.png" />
</div>
</div>
</div>
```
**Step by step, na wetin dey happen for dis code:**
- **Creates** main page container with `id="page"` to hold all content
- **Establishes** two column containers: `left-container` and `right-container`
- **Organizes** 7 plants for left column and 7 plants for right column
- **Wraps** each plant image inside `plant-holder` div for individual positioning
- **Applies** consistent class names for CSS styling later
- **Assigns** unique IDs to each plant image for JavaScript interaction later
- **Includes** correct file paths wey point to di images folder
> 🤔 **Consider This**: Notice say all images get di same alt text "plant". Dis no good for accessibility. Screen reader users go hear "plant" 14 times without knowing which particular plant each image show. Fit think better, more descriptive alt text for each image?
> 📝 **HTML Element Types**: `<div>` elements be "block-level" and dem take full width, while `<span>` elements be "inline" and dem only take as much width as dem need. Wetin you think go happen if you change all these `<div>` tags to `<span>` tags?
### 🔄 **Pedagogical Check-in**
**Structure Understanding**: Take small time to review your HTML structure:
- ✅ Fit identify main containers for your layout?
- ✅ You understand why each image get unique ID?
- ✅ How you go describe di purpose of `plant-holder` divs?
**Visual Inspection**: Open your HTML file for browser. You suppose see:
- Basic list of plant images
- Images arranged for two columns
- Simple, unstyled layout
**Remember**: Dis plain look na wetin HTML suppose be before CSS styling!
With dis markup added, di plants go show for screen, though dem no go look polished yet na di work for CSS for di next lesson! For now, you get solid HTML foundation wey organize your content well and follow accessibility best practices.
## Using Semantic HTML for Accessibility
Semantic HTML mean say you dey pick HTML elements based on their meaning and purpose, no be only their appearance. When you use semantic markup, you dey talk di structure and meaning of your content to browsers, search engines, and assistive technologies like screen readers.
```mermaid
flowchart TD
A[Need to add content?] --> B{Wetin kain?}
B -->|Main heading| C["<h1>"]
B -->|Subheading| D["<h2>, <h3>, etc."]
B -->|Paragraph| E["<p>"]
B -->|List| F["<ul>, <ol>"]
B -->|Navigation| G["<nav>"]
B -->|Article| H["<article>"]
B -->|Section| I["<section>"]
B -->|Generic container| J["<div>"]
C --> K[Screen readers go talk am as main title]
D --> L[Mek proper heading hierarchy]
E --> M[Mek correct text spacing]
F --> N[Mek list navigation shortcuts work]
G --> O[Show navigation landmarks]
H --> P[Mark standalone content]
I --> Q[Put related content together]
J --> R[Use am only if no semantic tag fit]
style C fill:#4caf50
style D fill:#4caf50
style E fill:#4caf50
style F fill:#4caf50
style G fill:#2196f3
style H fill:#2196f3
style I fill:#2196f3
style J fill:#ff9800
```
Dis method dey make your websites more accessible to users with disabilities and dey help search engines better understand your content. E be fundamental principle of modern web development wey dey create better experiences for everybody.
### Adding a Semantic Page Title
Make we add proper heading to your terrarium page. Insert dis line right after your opening `<body>` tag:
```html
<h1>My Terrarium</h1>
```
**Why semantic markup dey important:**
- **Helps** screen readers navigate and understand page structure
- **Improves** search engine optimization (SEO) by clarifying content hierarchy
- **Enhances** accessibility for users with visual impairments or cognitive differences
- **Creates** better user experiences across all devices and platforms
- **Follows** web standards and best practices for professional development
**Examples of semantic vs. non-semantic choices:**
| Purpose | ✅ Semantic Choice | ❌ Non-Semantic Choice |
|---------|-------------------|------------------------|
| Main heading | `<h1>Title</h1>` | `<div class="big-text">Title</div>` |
| Navigation | `<nav><ul><li></li></ul></nav>` | `<div class="menu"><div></div></div>` |
| Button | `<button>Click me</button>` | `<span onclick="...">Click me</span>` |
| Article content | `<article><p></p></article>` | `<div class="content"><div></div></div>` |
> 🎥 **See It in Action**: Watch [how screen readers interact with web pages](https://www.youtube.com/watch?v=OUDV1gqs9GA) to understand why semantic markup dey important for accessibility. Notice how correct HTML structure dey help users navigate well.
## Creating the Terrarium Container
Now make we add di HTML structure for di terrarium itself di glass container wey plants go eventually dey inside. Dis section dey show important concept: HTML dey provide structure, but without CSS styling, these elements no go visible yet.
Di terrarium markup dey use descriptive class names wey go make CSS styling simple and maintainable for next lesson.
### Task: Add the Terrarium Structure
Insert dis markup above di last `</div>` tag (before di closing tag of di page container):
```html
<div id="terrarium">
<div class="jar-top"></div>
<div class="jar-walls">
<div class="jar-glossy-long"></div>
<div class="jar-glossy-short"></div>
</div>
<div class="dirt"></div>
<div class="jar-bottom"></div>
</div>
```
**Understanding dis terrarium structure:**
- **Creates** main terrarium container with unique ID for styling
- **Defines** separate elements for each visual component (top, walls, dirt, bottom)
- **Includes** nested elements for glass reflection effects (glossy elements)
- **Uses** descriptive class names wey clearly show wetin each element dey do
- **Prepares** the structure for CSS styling wey go create the glass terrarium look
> 🤔 **Notice Something?**: Even though you add this markup, you no go see anything new for the page! This one clear how HTML dey provide structure and CSS na im dey provide appearance. These `<div>` elements dey but dem never get visual styling yet dat one go come for the next lesson!
```mermaid
flowchart TD
A[HTML Document] --> B[Document Head]
A --> C[Document Body]
B --> D[Title Element]
B --> E[Meta Charset]
B --> F[Meta Viewport]
C --> G[Main Heading]
C --> H[Page Container]
H --> I[Left Container wit 7 plants]
H --> J[Right Container wit 7 plants]
H --> K[Terrarium Structure]
style A fill:#e1f5fe
style B fill:#fff3e0
style C fill:#e8f5e8
style H fill:#f3e5f5
```
### 🔄 **Pedagogical Check-in**
**HTML Structure Mastery**: Before you move forward, make sure say you fit:
- ✅ Explain the difference between HTML structure and how e dey show for eye
- ✅ Identify semantic and non-semantic HTML elements
- ✅ Talk how correct markup go help make am easier for people to use your site well
- ✅ Recognize the full document tree structure
**Testing Your Understanding**: Try open your HTML file for browser wey JavaScript no dey and CSS comot finish. This one go show you the pure semantic structure wey you create!
---
## GitHub Copilot Agent Challenge
Use the Agent mode to complete the following challenge:
**Description:** Create a semantic HTML structure for plant care guide section wey fit add to the terrarium project.
**Prompt:** Create semantic HTML section wey get main heading "Plant Care Guide", three subsections wey get headings "Watering", "Light Requirements", and "Soil Care", each get paragraph wey talk plant care information. Use correct semantic HTML tags like `<section>`, `<h2>`, `<h3>`, and `<p>` to arrange the content well.
Learn more about [agent mode](https://code.visualstudio.com/blogs/2025/02/24/introducing-copilot-agent-mode) here.
## Explore HTML History Challenge
**Learning About Web Evolution**
HTML don evolve well well since Tim Berners-Lee make the first web browser for CERN for 1990. Some old tags like `<marquee>` don become outdated because dem no too work well with modern accessibility standards and responsive design.
**Try This Experiment:**
1. Temporarily put your `<h1>` title inside `<marquee>` tag: `<marquee><h1>My Terrarium</h1></marquee>`
2. Open your page for browser and watch the scrolling effect
3. Think why them ban that tag (hint: think about user experience and accessibility)
4. Remove the `<marquee>` tag and comot back to semantic markup
**Reflection Questions:**
- How e fit affect people wey get visual problem or motion sensitivity if title dey move like that?
- Which modern CSS ways fit do similar visual effects wey be better for everybody?
- Why e important to use current web standards instead of old elements wey no dey supported?
Explore more about [obsolete and deprecated HTML elements](https://developer.mozilla.org/docs/Web/HTML/Element#Obsolete_and_deprecated_elements) to sabi how web standards dey evolve to help user experience.
## Post-Lecture Quiz
[Post-lecture quiz](https://ff-quizzes.netlify.app/web/quiz/16)
## Review & Self Study
**Deepen Your HTML Knowledge**
HTML don be the base of web for over 30 years, e begin as simple document markup language, now e don become strong platform to build interactive applications. To sabi dis evolution go help you appreciate modern web standards and take better development decisions.
**Recommended Learning Paths:**
1. **HTML History and Evolution**
- Research from HTML 1.0 reach HTML5
- Find out why some tags they ban (because of accessibility, mobile-friendliness, maintainability)
- Explore new HTML features and proposals
2. **Semantic HTML Deep Dive**
- Learn the full list of [HTML5 semantic elements](https://developer.mozilla.org/docs/Web/HTML/Element)
- Practice when to use `<article>`, `<section>`, `<aside>`, and `<main>`
- Learn about ARIA attributes for better accessibility
3. **Modern Web Development**
- Explore [building responsive websites](https://docs.microsoft.com/learn/modules/build-simple-website/?WT.mc_id=academic-77807-sagibbon) on Microsoft Learn
- Understand how HTML dey connect with CSS and JavaScript
- Learn about web performance and SEO best practices
**Reflection Questions:**
- Which deprecated HTML tags you find, and why dem ban am?
- Which new HTML features dem dey plan for future versions?
- How semantic HTML dey help web accessibility and SEO?
### ⚡ **Wetin You Fit Do for Next 5 Minutes**
- [ ] Open DevTools (F12) check the HTML structure of your favourite website
- [ ] Create simple HTML file with basic tags: `<h1>`, `<p>`, and `<img>`
- [ ] Validate your HTML with W3C HTML Validator online
- [ ] Try add comment for your HTML with `<!-- comment -->`
### 🎯 **Wetin You Fit Achieve This Hour**
- [ ] Finish the post-lesson quiz and review semantic HTML concepts
- [ ] Build simple webpage about yourself with correct HTML structure
- [ ] Try different heading levels and text formatting tags
- [ ] Add images and links to practise multimedia work
- [ ] Research HTML5 features wey you never try yet
### 📅 **Your Week-Long HTML Journey**
- [ ] Finish the terrarium project with semantic markup
- [ ] Create accessible webpage using ARIA labels and roles
- [ ] Practice form building with different input types
- [ ] Explore HTML5 APIs like localStorage or geolocation
- [ ] Study responsive HTML patterns and mobile-first design
- [ ] Check other developers' HTML code for best practices
### 🌟 **Your Month-Long Web Foundation**
- [ ] Build portfolio website to show your HTML skill
- [ ] Learn HTML templating with framework like Handlebars
- [ ] Help open source projects by improving HTML docs
- [ ] Master advanced HTML concepts like custom elements
- [ ] Mix HTML with CSS frameworks and JavaScript libraries
- [ ] Mentor others wey dey learn HTML fundamentals
## 🎯 Your HTML Mastery Timeline
```mermaid
timeline
title HTML Learn Progress
section Foundation (5 minutes)
Document Structure: DOCTYPE declaration
: HTML root element
: Head vs Body sabi
section Metadata (10 minutes)
Essential Meta Tags: Character encoding
: Viewport configuration
: Browser compatibility
section Content Creation (15 minutes)
Image Integration: Proper file paths
: Alt text importance
: Self-closing tags
section Layout Organization (20 minutes)
Container Strategy: Div elements for structure
: Class and ID naming
: Nested element hierarchy
section Semantic Mastery (30 minutes)
Meaningful Markup: Heading hierarchy
: Screen reader navigation
: Accessibility best practices
section Advanced Concepts (1 hour)
HTML5 Features: Modern semantic elements
: ARIA attributes
: Performance considerations
section Professional Skills (1 week)
Code Organization: File structure patterns
: Maintainable markup
: Team collaboration
section Expert Level (1 month)
Modern Web Standards: Progressive enhancement
: Cross-browser compatibility
: HTML specification updates
```
### 🛠️ Your HTML Toolkit Summary
After you finish this lesson, you don get:
- **Document Structure**: Complete HTML5 foundation with correct DOCTYPE
- **Semantic Markup**: Meaningful tags wey improve accessibility and SEO
- **Image Integration**: Proper file organization and alt text practice
- **Layout Containers**: Smart use of divs with descriptive class names
- **Accessibility Awareness**: Understanding how screen readers navigate
- **Modern Standards**: Current HTML5 way and knowledge of deprecated tags
- **Project Foundation**: Strong base for CSS styling and JavaScript interactivity
**Next Steps**: Your HTML structure don ready for CSS styling! The semantic base you build go make the next lesson easy to understand.
## Assignment
[Practice your HTML: Build a blog mockup](assignment.md)
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document don translate wit AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator). Even though we try make e correct, make you sabi say automated translations fit get mistake or no too correct. Di original document wey e bin write for im own language na di correct one. For important information, e good make professional human translation do am. We no go responsible for any wrong understanding or mistake wey fit happen because of this translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,154 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "650e63282e1dfa032890fcf5c1c4119d",
"translation_date": "2026-01-08T18:48:31+00:00",
"source_file": "3-terrarium/1-intro-to-html/assignment.md",
"language_code": "pcm"
}
-->
# HTML Practice Assignment: Build a Blog Mockup
## Learning Objectives
Apply your HTML knowledge by designing and coding a complete blog homepage structure. Dis hand-on assignment go help you sabi semantic HTML concepts, accessibility best practices, and professional code organization skills wey you go dey use throughout your web development journey.
**By completing dis assignment, you go:**
- Practice how to plan website layouts before you start coding
- Use semantic HTML elements well well
- Create accessible, well-structured markup
- Develop professional coding habits with comments and organization
## Project Requirements
### Part 1: Design Planning (Visual Mockup)
**Create visual mockup of your blog homepage wey get:**
- Header with site title and navigation
- Main content area with at least 2-3 blog post previews
- Sidebar with extra information (about section, recent posts, categories)
- Footer with contact information or links
**Mockup Creation Options:**
- **Hand-drawn sketch**: Use paper and pencil, then take picture or scan your design
- **Digital tools**: Figma, Adobe XD, Canva, PowerPoint, or any drawing app
- **Wireframe tools**: Balsamiq, MockFlow, or any like that wireframing software
**Label your mockup sections** with the HTML elements wey you plan to use (e.g., "Header - `<header>`", "Blog Posts - `<article>`").
### Part 2: HTML Element Planning
**Make list wey go map each section of your mockup to the specific HTML elements:**
```
Example:
- Site Header → <header>
- Main Navigation → <nav> with <ul> and <li>
- Blog Post → <article> with <h2>, <p>, <time>
- Sidebar → <aside> with <section> elements
- Page Footer → <footer>
```
**Required Elements to Include:**
Your HTML must get at least 10 different semantic elements from dis list:
- `<header>`, `<nav>`, `<main>`, `<article>`, `<section>`, `<aside>`, `<footer>`
- `<h1>`, `<h2>`, `<h3>`, `<p>`, `<ul>`, `<li>`, `<a>`
- `<img>`, `<time>`, `<blockquote>`, `<strong>`, `<em>`
### Part 3: HTML Implementation
**Code your blog homepage based on these standards:**
1. **Document Structure**: Include correct DOCTYPE, html, head, and body elements
2. **Semantic Markup**: Use HTML elements for wetin dem suppose represent
3. **Accessibility**: Put correct alt text for images and meaningful link text
4. **Code Quality**: Use consistent indentation and meaningful comments
5. **Content**: Include real blog content (you fit use placeholder text)
**Sample HTML Structure:**
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Personal Blog</title>
</head>
<body>
<!-- Main site header -->
<header>
<h1>My Blog Title</h1>
<nav>
<!-- Navigation menu -->
</nav>
</header>
<!-- Main content area -->
<main>
<!-- Blog posts go here -->
</main>
<!-- Sidebar content -->
<aside>
<!-- Additional information -->
</aside>
<!-- Site footer -->
<footer>
<!-- Footer content -->
</footer>
</body>
</html>
```
### Part 4: Reflection
**Write small reflection (3-5 sentences) wey go talk about:**
- Which HTML elements you dey most confident to use?
- Which challenges you face during the planning or coding?
- How semantic HTML take help organize your content?
- Wetin you go do different for your next HTML project?
## Submission Checklist
**Before you submit, check say you get:**
- [ ] Visual mockup wey get labeled HTML elements
- [ ] Complete HTML file with correct document structure
- [ ] At least 10 different semantic HTML elements wey you use well
- [ ] Meaningful comments wey explain your code structure
- [ ] Valid HTML syntax (test am for browser)
- [ ] Written reflection wey answer the prompt questions
## Assessment Rubric
| Criteria | Exemplary (4) | Proficient (3) | Developing (2) | Beginning (1) |
|----------|---------------|----------------|----------------|---------------|
| **Planning & Design** | Detailed, well-labeled mockup wey clear show how you sabi layout and HTML semantic structure | Clear mockup wey most sections labeled correct | Basic mockup with some labeling, show say you get general understanding | Minimal or unclear mockup, no proper section identification |
| **Semantic HTML Usage** | Use 10+ semantic elements well, show deep understanding of HTML structure and accessibility | Use 8-9 semantic elements correct, show good understanding of semantic markup | Use 6-7 semantic elements, small confusion about correct use | Use less than 6 elements or misuse semantic elements |
| **Code Quality & Organization** | Exceptionally well-organized, properly indented code with detailed comments and perfect HTML syntax | Well-organized code with good indentation, helpful comments, and valid syntax | Mostly organized code with some comments, small syntax problems | Poor organization, few comments, many syntax errors |
| **Accessibility & Best Practices** | Excellent accessibility, meaningful alt text, proper heading order, follow all modern HTML best practices | Good accessibility features, proper use of headings and alt text, follow most good practices | Some accessibility consideration, basic alt text and heading structure | Limited accessibility, poor heading structure, no follow best practices |
| **Reflection & Learning** | Insightful reflection wey show deep understanding of HTML concepts and thoughtful learning analysis | Good reflection wey show understanding of key concepts and some self-awareness | Basic reflection with small insight on HTML concepts or learning | Minimal or no reflection, no show understanding of concepts learned |
## Learning Resources
**Essential References:**
- [MDN HTML Elements Reference](https://developer.mozilla.org/docs/Web/HTML/Element) - Complete guide to all HTML elements
- [HTML5 Semantic Elements](https://developer.mozilla.org/docs/Web/HTML/Element#content_sectioning) - Understand semantic markup
- [Web Accessibility Guidelines](https://www.w3.org/WAI/WCAG21/quickref/) - How to create accessible web content
- [HTML Validator](https://validator.w3.org/) - Check your HTML syntax
**Pro Tips for Success:**
- Start with your mockup before you begin any coding
- Use browser developer tools to check your HTML structure
- Test your page for different screen sizes (even if you no get CSS)
- Read your HTML aloud to see if the structure make sense
- Think about how screen reader go take interpret your page structure
> 💡 **Remember**: This assignment na about HTML structure and semantics. No worry about visual styling na wetin CSS dey do! Your page fit look simple, but e suppose well-structured and get meaning.
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document na AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator) wey translate am. Even though we dey try make e correct, e good make you sabi say automated translation fit get some mistakes or errors. The original document wey e dey for im original language na im suppose be the correct one. If na important information, e better make professional human translator do am. We no go responsible for any wahala or wrong meaning wey fit come from how dis translation take be.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,726 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "e39f3a4e3bcccf94639e3af1248f8a4d",
"translation_date": "2026-01-08T19:10:37+00:00",
"source_file": "3-terrarium/2-intro-to-css/README.md",
"language_code": "pcm"
}
-->
# Terrarium Project Part 2: Introduction to CSS
```mermaid
journey
title Your CSS Styling Journey
section Foundation
Link CSS file: 3: Student
Understand cascade: 4: Student
Learn inheritance: 4: Student
section Selectors
Element targeting: 4: Student
Class patterns: 5: Student
ID specificity: 5: Student
section Layout
Position elements: 4: Student
Create containers: 5: Student
Build terrarium: 5: Student
section Polish
Add visual effects: 5: Student
Responsive design: 5: Student
Glass reflections: 5: Student
```
![Introduction to CSS](../../../../translated_images/webdev101-css.3f7af5991bf53a20.pcm.png)
> Sketchnote by [Tomomi Imura](https://twitter.com/girlie_mac)
Memba how your HTML terrarium bin fine simple? CSS na di place wey we go take change dat plain structure come one wey fine for eye.
If HTML be like di building frame for house, then CSS na wetin make e feel like home - di paint color dem, how furniture arrange, di light dem, and how di rooms dey flow together. Think about how Palace of Versailles start as small hunting lodge, but correct attention to decoration and layout turn am to one of di worlds most fine buildings.
Today, we go change your terrarium from just working to fine finish. You go learn how to position elements correct correct, make layouts dey respond to different screen sizes, and make di visual fine wey dey make websites dey interesting.
By di end of dis lesson, you go see how correct CSS styling fit improve your project well well. Make we add style to your terrarium.
```mermaid
mindmap
root((CSS Fundamentals))
Cascade
Specificity Rules
Inheritance
Priority Order
Conflict Resolution
Selectors
Element Tags
Classes (.class)
IDs (#id)
Combinators
Box Model
Margin
Border
Padding
Content
Layout
Positioning
Display Types
Flexbox
Grid
Visual Effects
Colors
Shadows
Transitions
Animations
Responsive Design
Media Queries
Flexible Units
Viewport Meta
Mobile First
```
## Pre-Lecture Quiz
[Pre-lecture quiz](https://ff-quizzes.netlify.app/web/quiz/17)
## Getting Started with CSS
People often talk say CSS na just to make things fine, but e get plenty purpose pass dat. CSS na like director for movie - you dey control not just how everything look, but how e dey move, how e take respond to interaction, and how e take change for different situations.
Modern CSS get power well well. You fit write code wey go automatically adjust layout for phone, tablet, and desktop. You fit create smooth animation wey go guide users eye where e suppose dey. Di result fit dey very impressive when everything work together well.
> 💡 **Pro Tip**: CSS dey always dey evolve with new features and power. Always check [CanIUse.com](https://caniuse.com) to confirm browser support for new CSS features before you use am for production projects.
**Wet we go do for dis lesson be:**
- **Create** complete visual design for your terrarium using modern CSS techniques
- **Explore** fundamental concepts like cascade, inheritance, and CSS selectors
- **Implement** responsive positioning and layout strategies
- **Build** di terrarium container using CSS shapes and styling
### Prerequisite
You suppose don finish di HTML structure for your terrarium from di last lesson and dem dey ready for styling.
> 📺 **Video Resource**: Check dis helpful video walkthrough
>
> [![CSS Basics Tutorial](https://img.youtube.com/vi/6yIdOIV9p1I/0.jpg)](https://www.youtube.com/watch?v=6yIdOIV9p1I)
### Setting Up Your CSS File
Before we fit start styling, we gats connect CSS to our HTML. Dis connection go tell di browser where to find di styling instruction for our terrarium.
For your terrarium folder, create new file wey dem go call `style.css`, then link am for your HTML document `<head>` section:
```html
<link rel="stylesheet" href="./style.css" />
```
**Wet dis code dey do be:**
- **Create** connection between your HTML and CSS files
- **Tell** di browser to load and apply di styles from `style.css`
- **Use** di `rel="stylesheet"` attribute to talk say dis na CSS file
- **Reference** di file path with `href="./style.css"`
## Understanding the CSS Cascade
You don ever wonder why dem call CSS "Cascading" Style Sheets? Styles dey cascade down like waterfall, and sometimes dem dey clash.
Think about how military command structures dey work - one general order fit talk say "all troops make dem wear green," but specific order for your unit fit talk say "wear dress blues for di ceremony." Di specific order go win. CSS dey follow dis kind logic, and if you understand dis hierarchy, e go make debugging easy.
### Experimenting with Cascade Priority
Make we see di cascade work by creating style wahala. First, add inline style to your `<h1>` tag:
```html
<h1 style="color: red">My Terrarium</h1>
```
**Wet dis code dey do:**
- **Apply** red color direct to `<h1>` element using inline styling
- **Use** di `style` attribute to put CSS direct for HTML
- **Create** highest priority style rule for dis specific element
Next, put dis rule for your `style.css` file:
```css
h1 {
color: blue;
}
```
**For di code top, we:**
- **Define** CSS rule wey target all `<h1>` elements
- **Set** di text color to blue using external stylesheet
- **Create** lower priority rule compared to inline styles
**Knowledge Check**: Which color your web app go show? Why dat color win? You fit think of situations wey you go like override styles?
```mermaid
flowchart TD
A["Browser jam h1 element"] --> B{"Check for inline styles"}
B -->|Found| C["style='color: red'"]
B -->|None| D{"Check for ID rules"}
C --> E["Apply red color (1000 points)"]
D -->|Found| F["#heading { color: green }"]
D -->|None| G{"Check for class rules"}
F --> H["Apply green color (100 points)"]
G -->|Found| I[".title { color: blue }"]
G -->|None| J{"Check element rules"}
I --> K["Apply blue color (10 points)"]
J -->|Found| L["h1 { color: purple }"]
J -->|None| M["Use browser default"]
L --> N["Apply purple color (1 point)"]
style C fill:#ff6b6b
style F fill:#51cf66
style I fill:#339af0
style L fill:#9775fa
```
> 💡 **CSS Priority Order (from highest go lowest):**
> 1. **Inline styles** (style attribute)
> 2. **IDs** (#myId)
> 3. **Classes** (.myClass) and attributes
> 4. **Element selectors** (h1, div, p)
> 5. **Browser defaults**
## CSS Inheritance in Action
CSS inheritance be like genetics - elements dey inherit some properties from their parent elements. If you set font family for body element, all text inside go use dat same font. E resemble how Habsburg family jawline appear for generations without e get to talk about am for each person.
But no be everything dey inherit. Text styles like fonts and colors dey inherit, but layout properties like margins and borders no dey. Just like pikin fit inherit physical traits but no inherit their parents fashion choice.
### Observing Font Inheritance
Make we see inheritance work by setting font family on `<body>` element:
```css
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
```
**Wet happen here:**
- **Set** font family for whole page by targeting `<body>` element
- **Use** font stack with fallback options for better browser compatibility
- **Apply** modern system fonts wey fine for different operating systems
- **Ensure** all child elements inherit dis font unless dem override am
Open browser developer tools (F12), go Elements tab, inspect your `<h1>` element. You go see say e inherit font family from body:
![inherited font](../../../../translated_images/1.cc07a5cbe114ad1d.pcm.png)
**Experiment Time**: Try set other inheritable properties for `<body>` like `color`, `line-height`, or `text-align`. Wetin happen to your heading and other elements?
> 📝 **Inheritable Properties Include**: `color`, `font-family`, `font-size`, `line-height`, `text-align`, `visibility`
>
> **Non-Inheritable Properties Include**: `margin`, `padding`, `border`, `width`, `height`, `position`
### 🔄 **Pedagogical Check-in**
**CSS Foundation Understanding**: Before you waka go selectors, make sure you fit:
- ✅ Explain di difference between cascade and inheritance
- ✅ Predict which style go win for specificity conflict
- ✅ Identify which properties dey inherit from parent elements
- ✅ Connect CSS files to HTML correct
**Quick Test**: If you get these styles, which color `<h1>` inside `<div class="special">` go be?
```css
div { color: blue; }
.special { color: green; }
h1 { color: red; }
```
*Answer: Red (element selector direct target h1)*
## Mastering CSS Selectors
CSS selectors na your way to target specific elements for styling. Dem work like giving exact direction - instead of saying "di house," you fit talk "di blue house wey get red door for Maple Street."
CSS get different ways to be specific, and to choose di correct selector na like to choose correct tool for di job. Sometimes you want style every door for neighborhood, sometime na just the one door.
### Element Selectors (Tags)
Element selectors dey target HTML elements by their tag name. Dem good for base styles wey go apply for the entire page:
```css
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
margin: 0;
padding: 0;
}
h1 {
color: #3a241d;
text-align: center;
font-size: 2.5rem;
margin-bottom: 1rem;
}
```
**Understanding dis styles:**
- **Set** consistent typography across whole page with `body` selector
- **Remove** default browser margins and padding for better control
- **Style** all heading elements with color, alignment, and spacing
- **Use** `rem` units for font wey fit scale and dey accessible
Even though element selectors good for general styling, you go still need specific selectors to style individual parts like di plants for your terrarium.
### ID Selectors for Unique Elements
ID selectors use `#` symbol and dem target elements with specific `id` attributes. Because IDs suppose to be unique for a page, dem good for styling individual special elements like our left and right plant containers.
Make we create styling for our terrarium side containers wey plants go dey:
```css
#left-container {
background-color: #f5f5f5;
width: 15%;
left: 0;
top: 0;
position: absolute;
height: 100vh;
padding: 1rem;
box-sizing: border-box;
}
#right-container {
background-color: #f5f5f5;
width: 15%;
right: 0;
top: 0;
position: absolute;
height: 100vh;
padding: 1rem;
box-sizing: border-box;
}
```
**Wet dis code do be:**
- **Position** containers for far left and right side using `absolute` positioning
- **Use** `vh` (viewport height) units for height wey go adjust according to screen size
- **Apply** `box-sizing: border-box` to include padding for overall width
- **Remove** unnecessary `px` units from zero values to make code fine
- **Set** subtle background color wey easy for eye pass plain gray
**Code Quality Challenge**: You notice say dis CSS dey break DRY (Don't Repeat Yourself) rule. Fit refactor am with both ID and class?
**Better way to do am:**
```html
<div id="left-container" class="container"></div>
<div id="right-container" class="container"></div>
```
```css
.container {
background-color: #f5f5f5;
width: 15%;
top: 0;
position: absolute;
height: 100vh;
padding: 1rem;
box-sizing: border-box;
}
#left-container {
left: 0;
}
#right-container {
right: 0;
}
```
### Class Selectors for Reusable Styles
Class selectors use `.` symbol and dem good for when you want apply same styles to many elements. Unlike IDs, classes fit dey used plenty times for your HTML, making dem perfect for consistent styling.
Inside our terrarium, each plant need similar styling but also need individual position. We go use mix of classes for shared styles and IDs for individual placement.
**Dis na di HTML structure for each plant:**
```html
<div class="plant-holder">
<img class="plant" alt="Decorative plant for terrarium" id="plant1" src="../../../../translated_images/plant1.d18b18ffe73da18f.pcm.png" />
</div>
```
**Key elements explain:**
- **Use** `class="plant-holder"` for container styling wey dey same for all plants
- **Apply** `class="plant"` for shared image styling and behaviour
- **Include** unique `id="plant1"` for individual positioning and JavaScript interaction
- **Provide** descriptive alt text for screen reader access
Now put these styles for your `style.css` file:
```css
.plant-holder {
position: relative;
height: 13%;
left: -0.6rem;
}
.plant {
position: absolute;
max-width: 150%;
max-height: 150%;
z-index: 2;
transition: transform 0.3s ease;
}
.plant:hover {
transform: scale(1.05);
}
```
**Wet dey happen for these styles:**
- **Create** relative positioning for plant holder to make positioning context
- **Set** each plant holder to 13% height, to fit all plants vertically without scrolling
- **Shift** holders small left to better center plants inside their container
- **Allow** plants to scale responsively using `max-width` and `max-height`
- **Use** `z-index` to put plants ahead of other things for terrarium
- **Add** small hover effect with CSS transitions for better user interaction
**Critical Thinking**: Why we need both `.plant-holder` and `.plant` selectors? Which tin go happen if you use only one?
> 💡 **Design Pattern**: Container (`.plant-holder`) control layout and positioning, content (`.plant`) control appearance and scaling. Dis kind separation make code easier to maintain and more flexible.
## Understanding CSS Positioning
CSS positioning na like being stage director for play - you direct where each actor stand and how dem move. Some actors follow normal formation, others need special position for drama.
Once you understand positioning, many layout problems go dey easy. You want navigation bar wey no go comot from top when user dey scroll? Positioning na di solution. You want tooltip wey go show for one specific place? Na positioning too.
### The Five Position Values
```mermaid
quadrantChart
title CSS Positioning Strategy
x-axis Document Flow --> Removed from Flow
y-axis Static Position --> Precise Control
quadrant-1 Absolute
quadrant-2 Fixed
quadrant-3 Static
quadrant-4 Sticky
Static: [0.2, 0.2]
Relative: [0.3, 0.6]
Absolute: [0.8, 0.8]
Fixed: [0.9, 0.7]
Sticky: [0.5, 0.9]
```
| Position Value | Behavior | Use Case |
|----------------|----------|----------|
| `static` | Default flow, no mind top/left/right/bottom | Normal document layout |
| `relative` | Position relative to normal place | Small movements, create positioning context |
| `absolute` | Position relative to closest positioned ancestor | Exact placement, overlays |
| `fixed` | Position relative to viewport | Navigation bars, floating elements |
| `sticky` | Switch between relative and fixed depending on scroll | Headers wey stick as you scroll |
### Positioning in Our Terrarium
Our terrarium use correct combination of positioning types to get di layout we want:
```css
/* Container positioning */
.container {
position: absolute; /* Removes from normal flow */
/* ... other styles ... */
}
/* Plant holder positioning */
.plant-holder {
position: relative; /* Creates positioning context */
/* ... other styles ... */
}
/* Plant positioning */
.plant {
position: absolute; /* Allows precise placement within holder */
/* ... other styles ... */
}
```
**Understand di positioning strategy:**
- **Absolute containers** comot for normal document flow and dey pinned to screen edges
- **Relative plant holders** create positioning context while dem dey for document flow
- **Absolute plants** fit position well inside their relative containers
- **Dis combination** allow plants stack vertical and still fit uniquely positioned each one
> 🎯 **Why Dis Important**: Di `plant` elements need absolute positioning so dem fit dey draggable for next lesson. Absolute positioning comot dem from normal layout flow, make drag-and-drop interaction possible.
**Experiment Time**: Try change positioning values and watch wetin happen:
- Wetin go happen if you change `.container` from `absolute` to `relative`?
- How di layout go change if `.plant-holder` use `absolute` instead of `relative`?
- Wetin go happen when you switch `.plant` to `relative` positioning?
### 🔄 **Pedagogical Check-in**
**CSS Positioning Mastery**: Pause to check say you sabi well:
- ✅ You fit explain why plants need absolute positioning for drag-and-drop?
- ✅ You understand how relative containers dey create positioning context?
- ✅ Why side containers dem dey use absolute positioning?
- ✅ Wetin go happen if you comot position declarations finish?
**Real-World Connection**: Think about how CSS positioning dey imitate real-world layout:
- **Static**: Books for shelf (natural order)
- **Relative**: Move book small but still keep im position
- **Absolute**: Put bookmark for exact page number
- **Fixed**: Sticky note wey dey remain visible as you dey flip pages
## Building the Terrarium with CSS
Now we go build glass jar using only CSS - no images or graphics software needed.
To create glass wey dey realistic, shadows, and depth effects using positioning and transparency na how CSS sabi make things visual. This method dey resemble how architects for Bauhaus movement take simple geometric shapes create complex, beautiful buildings. Once you understand these principles, you go fit see the CSS skill for many web designs.
```mermaid
flowchart LR
A[Jar Top] --> E[Complete Terrarium]
B[Jar Walls] --> E
C[Dirt Layer] --> E
D[Jar Bottom] --> E
F[Glass Effects] --> E
A1["50% width<br/>5% height<br/>Top position"] --> A
B1["60% width<br/>80% height<br/>Rounded corners<br/>0.5 opacity"] --> B
C1["60% width<br/>5% height<br/>Dark brown<br/>Bottom layer"] --> C
D1["50% width<br/>1% height<br/>Bottom position"] --> D
F1["Small shadows<br/>See through<br/>Z-index layering"] --> F
style E fill:#d1e1df,stroke:#3a241d
style A fill:#e8f5e8
style B fill:#e8f5e8
style C fill:#8B4513
style D fill:#e8f5e8
```
### Creating the Glass Jar Components
Make we build the terrarium jar piece by piece. Each part use absolute positioning and percentage-based sizing for responsive design:
```css
.jar-walls {
height: 80%;
width: 60%;
background: #d1e1df;
border-radius: 1rem;
position: absolute;
bottom: 0.5%;
left: 20%;
opacity: 0.5;
z-index: 1;
box-shadow: inset 0 0 2rem rgba(0, 0, 0, 0.1);
}
.jar-top {
width: 50%;
height: 5%;
background: #d1e1df;
position: absolute;
bottom: 80.5%;
left: 25%;
opacity: 0.7;
z-index: 1;
border-radius: 0.5rem 0.5rem 0 0;
}
.jar-bottom {
width: 50%;
height: 1%;
background: #d1e1df;
position: absolute;
bottom: 0;
left: 25%;
opacity: 0.7;
border-radius: 0 0 0.5rem 0.5rem;
}
.dirt {
width: 60%;
height: 5%;
background: #3a241d;
position: absolute;
border-radius: 0 0 1rem 1rem;
bottom: 1%;
left: 20%;
opacity: 0.7;
z-index: -1;
}
```
**Understanding the terrarium construction:**
- **Uses** percentage-based dimensions for scaling well on all screen sizes
- **Positions** elements absolute to stack and align am well
- **Applies** different opacity levels to make glass transparency effect
- **Implements** `z-index` layering so plants fit show inside the jar
- **Adds** subtle box-shadow and neat border-radius for more realistic look
### Responsive Design with Percentages
See how all dimensions dey use percentage instead of fixed pixel values:
**Why dis matter:**
- **Ensure** say terrarium scales well for any screen size
- **Maintain** visual relationship between jar parts
- **Provide** consistent experience from mobile phones to big desktop monitors
- **Allow** design to adapt without spoiling visual layout
### CSS Units in Action
We dey use `rem` units for border-radius, wey scale relative to root font size. This one dey create easier-to-access designs wey respect user font preferences. Learn more about [CSS relative units](https://www.w3.org/TR/css-values-3/#font-relative-lengths) for official specs.
**Visual Experimentation**: Try change these values and watch di effects:
- Change jar opacity from 0.5 to 0.8 how e go affect glass look?
- Change dirt color from `#3a241d` to `#8B4513` which kind visual impact e get?
- Modify `z-index` of dirt to 2 wetin go happen to layering?
### 🔄 **Pedagogical Check-in**
**CSS Visual Design Understanding**: Confirm say you sabi visual CSS well:
- ✅ How percentage-based dimensions dey create responsive design?
- ✅ Why opacity dey create glass transparency effect?
- ✅ Wetin be role of z-index for layering elements?
- ✅ How border-radius values dey create jar shape?
**Design Principle**: Notice how we dey build complex visuals from simple shapes:
1. **Rectangles****Rounded rectangles** → **Jar components**
2. **Flat colors****Opacity** → **Glass effect**
3. **Individual elements****Layered composition** → **3D appearance**
---
## GitHub Copilot Agent Challenge 🚀
Use Agent mode to complete this challenge:
**Description:** Create CSS animation wey go make terrarium plants gently sway back and forth, like breeze dey blow. This go help you practice CSS animations, transforms, and keyframes to make your terrarium fine.
**Prompt:** Add CSS keyframe animations to make the plants for terrarium sway gently side to side. Create sway animation wey go rotate each plant small (2-3 degrees) left and right with duration of 3-4 seconds, and apply am to `.plant` class. Make sure say animation dey loop forever and get easing function for natural movement.
Learn more about [agent mode](https://code.visualstudio.com/blogs/2025/02/24/introducing-copilot-agent-mode) here.
## 🚀 Challenge: Adding Glass Reflections
Ready to make your terrarium better with real glass reflections? This technique go add depth and realism to design.
You go create subtle white or light-colored oval shapes for glass reflections. Position dem well for left side of jar, apply correct opacity and blur effects for realistic light reflection, use `border-radius` to make organic, bubble-like shapes, and experiment with gradients or box-shadows for strong realism.
## Post-Lecture Quiz
[Post-lecture quiz](https://ff-quizzes.netlify.app/web/quiz/18)
## Expand Your CSS Knowledge
CSS fit look hard at first, but understanding these main concepts go give you strong foundation for advanced techniques.
**Your next CSS learning areas:**
- **Flexbox** - simplify alignment and distribution of elements
- **CSS Grid** - give powerful tools for complex layouts
- **CSS Variables** - reduce repetition and make maintenance easy
- **Responsive design** - make sure sites work well on different screen sizes
### Interactive Learning Resources
Practice these concepts with these fun, hands-on games:
- 🐸 [Flexbox Froggy](https://flexboxfroggy.com/) - Master Flexbox through fun challenges
- 🌱 [Grid Garden](https://codepip.com/games/grid-garden/) - Learn CSS Grid by growing virtual carrots
- 🎯 [CSS Battle](https://cssbattle.dev/) - Test your CSS skills with coding challenges
### Additional Learning
For full CSS basics, finish this Microsoft Learn module: [Style your HTML app with CSS](https://docs.microsoft.com/learn/modules/build-simple-website/4-css-basics/?WT.mc_id=academic-77807-sagibbon)
### ⚡ **Wetin You Fit Do For Next 5 Minutes**
- [ ] Open DevTools and inspect CSS styles on any website using Elements panel
- [ ] Create simple CSS file and link am to HTML page
- [ ] Try change colors using diff methods: hex, RGB, and named colors
- [ ] Practice box model by adding padding and margin to div
### 🎯 **Wetin You Fit Achieve Dis Hour**
- [ ] Complete post-lesson quiz and review CSS basics
- [ ] Style your HTML page with fonts, colors, and spacing
- [ ] Create simple layout using flexbox or grid
- [ ] Experiment with CSS transitions for smooth effects
- [ ] Practice responsive design with media queries
### 📅 **Your Week-Long CSS Journey**
- [ ] Complete terrarium styling task with creativity
- [ ] Master CSS Grid by building photo gallery layout
- [ ] Learn CSS animations to bring your designs alive
- [ ] Explore CSS preprocessors like Sass or Less
- [ ] Study design principles and apply am for CSS
- [ ] Analyze and recreate interesting designs you find online
### 🌟 **Your Month-Long Design Mastery**
- [ ] Build complete responsive website design system
- [ ] Learn CSS-in-JS or utility-first frameworks like Tailwind
- [ ] Contribute to open source projects with CSS improvements
- [ ] Master advanced CSS concepts like custom properties and containment
- [ ] Create reusable components libraries with modular CSS
- [ ] Mentor others wey dey learn CSS and share design knowledge
## 🎯 Your CSS Mastery Timeline
```mermaid
timeline
title CSS Lernin Progression
section Foundation (10 minutes)
File Connection: Link CSS to HTML
: Undastan cascade rules
: Learn inheritance basics
section Selectors (15 minutes)
Targetin Elements: Element selectors
: Class patterns
: ID specificity
: Combinators
section Box Model (20 minutes)
Layout Fundamentals: Margin and padding
: Border properties
: Content sizing
: Box-sizing behavior
section Positioning (25 minutes)
Element Placement: Static vs relative
: Absolute positioning
: Z-index layering
: Responsive units
section Visual Design (30 minutes)
Styling Mastery: Colors and opacity
: Shadows and effects
: Transitions
: Transform properties
section Responsive Design (45 minutes)
Multi-Device Support: Media queries
: Flexible layouts
: Mobile-first approach
: Viewport optimization
section Advanced Techniques (1 week)
Modern CSS: Flexbox layouts
: CSS Grid systems
: Custom properties
: Animation keyframes
section Professional Skills (1 month)
CSS Architecture: Component patterns
: Maintainable code
: Performance optimization
: Cross-browser compatibility
```
### 🛠️ Your CSS Toolkit Summary
After completing dis lesson, you get:
- **Cascade Understanding**: How styles dey inherit and override each other
- **Selector Mastery**: Precise targeting with elements, classes, and IDs
- **Positioning Skills**: Strategic element placing and layering
- **Visual Design**: Creating glass effects, shadows, and transparency
- **Responsive Techniques**: Percentage-based layouts wey go adapt to any screen
- **Code Organization**: Clean, maintainable CSS structure
- **Modern Practices**: Using relative units and accessible design patterns
**Next Steps**: Your terrarium now get both structure (HTML) and style (CSS). Final lesson go add interactivity with JavaScript!
## Assignment
[CSS Refactoring](assignment.md)
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document don translate wit AI translation service wey dem dey call [Co-op Translator](https://github.com/Azure/co-op-translator). Even though we try make am correct, abeg make you sabi say automated translation fit get some mistakes or wrong tins. Di original document wey na di native language na di correct source. If na important tin you dey look for, make you use person wey sabi professional translation. We no go carry any yawa wey fit happen if person misunderstand or misinterpret dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,135 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "bee6762d4092a13fc7c338814963f980",
"translation_date": "2026-01-08T19:27:07+00:00",
"source_file": "3-terrarium/2-intro-to-css/assignment.md",
"language_code": "pcm"
}
-->
# CSS Refactoring Assignment
## Objective
Transform your terrarium project to use modern CSS layout techniques! Refactor the current absolute positioning approach to implement **Flexbox** or **CSS Grid** for a more maintainable, responsive design. Dis assignment dey challenge you to apply modern CSS standards while you still dey keep the fine look wey your terrarium get.
Knowing wen and how to use different layout methods na important skill for modern web development. Dis exercise go join old style positioning techniques with current CSS layout systems.
## Assignment Instructions
### Phase 1: Analysis and Planning
1. **Review your current terrarium code** - Find out which elements dey use absolute positioning now
2. **Choose your layout method** - Decide if Flexbox or CSS Grid go better for your design goals
3. **Sketch your new layout structure** - Plan how containers and plant elements go arrange
### Phase 2: Implementation
1. **Create a new version** of your terrarium project for another folder
2. **Update the HTML structure** as e suppose be to fit your chosen layout method
3. **Refactor the CSS** make e use Flexbox or CSS Grid instead of absolute positioning
4. **Maintain visual consistency** - Make sure your plants and terrarium jar still dey the same places
5. **Implement responsive behavior** - Your layout go fit change well well for different screen sizes
### Phase 3: Testing and Documentation
1. **Cross-browser testing** - Check say your design dey work well for Chrome, Firefox, Edge, and Safari
2. **Responsive testing** - Look your layout for mobile, tablet, and desktop screen sizes
3. **Documentation** - Add comments for your CSS wey talk about your layout choices
4. **Screenshots** - Take picture of your terrarium for different browsers and screen sizes
## Technical Requirements
### Layout Implementation
- **Choose ONE**: Make you use either Flexbox OR CSS Grid (no mix for same elements)
- **Responsive Design**: Use relative units (`rem`, `em`, `%`, `vw`, `vh`) no be fixed pixels
- **Accessibility**: Keep correct semantic HTML structure and alt text
- **Code Quality**: Use consistent naming style and arrange CSS well well
### Modern CSS Features to Include
```css
/* Example Flexbox approach */
.terrarium-container {
display: flex;
flex-direction: column;
min-height: 100vh;
align-items: center;
justify-content: center;
}
.plant-containers {
display: flex;
justify-content: space-between;
width: 100%;
max-width: 1200px;
}
/* Example Grid approach */
.terrarium-layout {
display: grid;
grid-template-columns: 1fr 3fr 1fr;
grid-template-rows: auto 1fr;
min-height: 100vh;
gap: 1rem;
}
```
### Browser Support Requirements
- **Chrome/Edge**: Latest 2 versions
- **Firefox**: Latest 2 versions
- **Safari**: Latest 2 versions
- **Mobile browsers**: iOS Safari, Chrome Mobile
## Deliverables
1. **Updated HTML file** wey get better semantic structure
2. **Refactored CSS file** wey use modern layout techniques
3. **Screenshot collection** wey show cross-browser compatibility:
- Desktop view (1920x1080)
- Tablet view (768x1024)
- Mobile view (375x667)
- At least 2 different browsers
4. **README.md file** wey show:
- Wetin you choose (Flexbox or Grid) and why you choose am
- Wahala wey you face during refactoring
- Browser compatibility notes
- How to run your code
## Assessment Rubric
| Criteria | Exemplary (4) | Proficient (3) | Developing (2) | Beginning (1) |
|----------|---------------|----------------|---------------|---------------|
| **Layout Implementation** | Correct Flexbox/Grid use with advanced features; full responsivity | Good implementation with good responsive behavior | Basic implementation with small responsive wahala | Incomplete or wrong layout implementation |
| **Code Quality** | Clean, well-organized CSS with correct comments and consistent naming | Good organization plus some comments | Okay organization with few comments | Bad organization; hard to sabi |
| **Cross-Browser Compatibility** | Perfect for all browsers wey dem need plus screenshots | Good compatibility with small differences mentioned | Some compatibility wahala wey no spoil function | Big compatibility wahala or no testing |
| **Responsive Design** | Strong mobile-first with smooth breakpoints | Good responsive behavior with correct breakpoints | Basic responsive features with small problems | Limited or broken responsive behavior |
| **Documentation** | Detailed README with full explanations and insights | Good documentation covering everything | Basic documentation with small explanation | No or incomplete documentation |
## Helpful Resources
### Layout Method Guides
- 📖 [A Complete Guide to Flexbox](https://css-tricks.com/snippets/css/a-guide-to-flexbox/)
- 📖 [A Complete Guide to CSS Grid](https://css-tricks.com/snippets/css/complete-guide-grid/)
- 📖 [Flexbox vs Grid - Choose the Right Tool](https://blog.webdevsimplified.com/2022-11/flexbox-vs-grid/)
### Browser Testing Tools
- 🛠️ [Browser DevTools Responsive Mode](https://developer.chrome.com/docs/devtools/device-mode/)
- 🛠️ [Can I Use - Feature Support](https://caniuse.com/)
- 🛠️ [BrowserStack - Cross-browser Testing](https://www.browserstack.com/)
### Code Quality Tools
- ✅ [CSS Validator](https://jigsaw.w3.org/css-validator/)
- ✅ [HTML Validator](https://validator.w3.org/)
- ✅ [WebAIM Contrast Checker](https://webaim.org/resources/contrastchecker/)
## Bonus Challenges
🌟 **Advanced Layouts**: Use both Flexbox AND Grid for different parts of your design
🌟 **Animation Integration**: Add CSS transitions or animations to work with your new layout
🌟 **Dark Mode**: Use CSS custom property theme switcher
🌟 **Container Queries**: Use new container query techniques for responsiveness at component level
> 💡 **Remember**: The goal no be just to make e work, but to sabi WHY your chosen layout method na the best solution for dis design challenge!
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**: Dis document na translate wey AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator) help do. Even though we try make am correct, e good make you sabi say automated translation fit get errors or mistake. Original document wey dey im correct language na the main one wey you suppose trust. If na serious matter, better make person wey sabi do professional translation check am. We no go responsible for any kondo or wrong understanding wey fit happen because of this translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,771 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "973e48ad87d67bf5bb819746c9f8e302",
"translation_date": "2026-01-08T18:52:46+00:00",
"source_file": "3-terrarium/3-intro-to-DOM-and-closures/README.md",
"language_code": "pcm"
}
-->
# Terrarium Project Part 3: DOM Manipulation and JavaScript Closures
```mermaid
journey
title Your JavaScript DOM Journey
section Foundation
Understand DOM: 3: Student
Learn closures: 4: Student
Connect elements: 4: Student
section Interaction
Setup drag events: 4: Student
Track coordinates: 5: Student
Handle movement: 5: Student
section Polish
Add cleanup: 4: Student
Test functionality: 5: Student
Complete terrarium: 5: Student
```
![DOM and a closure](../../../../translated_images/webdev101-js.10280393044d7eaa.pcm.png)
> Sketchnote by [Tomomi Imura](https://twitter.com/girlie_mac)
Welcome to one of di most interesting tins for web development - to make tins wey fit react! Di Document Object Model (DOM) na bridge wey connect your HTML and JavaScript, and tiday we go use am bring your terrarium to life. Wen Tim Berners-Lee create di first web browser, e imagine say web go be place wey docs fit change and react - na di DOM sabi make dis thing happen.
We go also talk about JavaScript closures, wey fit sound hard at first. Think of closures like "memory pockets" weh your functions fit remember important tins. E be like how each plant for your terrarium get im own data record to sabi where e dey. By di end of dis lesson, you go understand how natural and useful dem be.
Dis na wetin we dey build: one terrarium weh users fit drag and drop plants anywhere dem want. You go learn di DOM manipulation skill wey dey power everything from drag-and-drop file upload to interactive games. Make we bring your terrarium alive.
```mermaid
mindmap
root((DOM & JavaScript))
DOM Tree
Element Selection
Property Access
Event Handling
Dynamic Updates
Events
Pointer Events
Mouse Events
Touch Events
Event Listeners
Closures
Private Variables
Function Scope
Memory Persistence
State Management
Drag & Drop
Position Tracking
Coordinate Math
Event Lifecycle
User Interaction
Modern Patterns
Event Delegation
Performance
Cross-Device
Accessibility
```
## Pre-Lecture Quiz
[Pre-lecture quiz](https://ff-quizzes.netlify.app/web/quiz/19)
## Understanding the DOM: Your Gateway to Interactive Web Pages
Di Document Object Model (DOM) na how JavaScript dey talk to your HTML elements. Wen your browser load one HTML page, e go create one structured picture of dat page for memory - na dat be di DOM. Think am like family tree wey every HTML element na family member wey JavaScript fit reach, change, or rearrange.
DOM manipulation dey change static pages to interactive websites. Anytime you see button change color wen you put mouse for top, content update without refresh page, or elements wey you fit drag comot, na DOM manipulation dey wok.
```mermaid
flowchart TD
A["Dokument"] --> B["HTML"]
B --> C["Head"]
B --> D["Body"]
C --> E["Title"]
C --> F["Meta Tags"]
D --> G["H1: Ma Teriyam"]
D --> H["Div: Pej Kontena"]
H --> I["Div: Left Kontena"]
H --> J["Div: Right Kontena"]
H --> K["Div: Teriyam"]
I --> L["Plant Elements 1-7"]
J --> M["Plant Elements 8-14"]
L --> N["img#plant1"]
L --> O["img#plant2"]
M --> P["img#plant8"]
M --> Q["img#plant9"]
style A fill:#e1f5fe
style B fill:#f3e5f5
style D fill:#e8f5e8
style H fill:#fff3e0
style N fill:#ffebee
style O fill:#ffebee
style P fill:#ffebee
style Q fill:#ffebee
```
![DOM tree representation](../../../../translated_images/dom-tree.7daf0e763cbbba92.pcm.png)
> A representation of the DOM and the HTML markup that references it. From [Olfa Nasraoui](https://www.researchgate.net/publication/221417012_Profile-Based_Focused_Crawler_for_Social_Media-Sharing_Websites)
**Dis na why DOM dey powerful:**
- **E dey provide** correct way to reach any element for your page
- **E go allow** dynamic content update without page reload
- **E go enable** quick response to user tins like clicks and drag
- **E dey form** foundation for modern interactive web apps
## JavaScript Closures: Creating Organized, Powerful Code
One [JavaScript closure](https://developer.mozilla.org/docs/Web/JavaScript/Closures) be like to give function e own private workspace with memory wey no go vanish. Think how Darwin finches for Galápagos Islands each carry different beak because of their special environment - closures dey work like dat, e dey create special functions wey "remember" dem own context even after their parent function don finish.
For our terrarium, closures dey help every plant remember where e dey on im own. Dis pattern dey everywhere for professional JavaScript development, so e good to sabi.
```mermaid
flowchart LR
A["dragElement(plant1)"] --> B["Dey Create Closure"]
A2["dragElement(plant2)"] --> B2["Dey Create Closure"]
B --> C["Private Variables"]
B2 --> C2["Private Variables"]
C --> D["pos1, pos2, pos3, pos4"]
C --> E["pointerDrag function"]
C --> F["elementDrag function"]
C --> G["stopElementDrag function"]
C2 --> D2["pos1, pos2, pos3, pos4"]
C2 --> E2["pointerDrag function"]
C2 --> F2["elementDrag function"]
C2 --> G2["stopElementDrag function"]
H["Plant 1 sabi where e dey"] --> B
H2["Plant 2 sabi where e dey"] --> B2
style B fill:#e8f5e8
style B2 fill:#e8f5e8
style C fill:#fff3e0
style C2 fill:#fff3e0
```
> 💡 **Understanding Closures**: Closures na big topic inside JavaScript, and many developers dey use am for years before dem understand all di theory. Tiday, we dey focus on how to use am for real - you go see closures naturally show as we dey build our interactive tins. You go understand well as you see how dem fit solve real problems.
![DOM tree representation](../../../../translated_images/dom-tree.7daf0e763cbbba92.pcm.png)
> A representation of the DOM and the HTML markup that references it. From [Olfa Nasraoui](https://www.researchgate.net/publication/221417012_Profile-Based_Focused_Crawler_for_Social_Media-Sharing_Websites)
For dis lesson, we go finish our interactive terrarium project by creating di JavaScript wey go allow user to manipulate plants for di page.
## Before We Begin: Setting Up for Success
You go need your HTML and CSS files from previous terrarium lessons - we dey go make dat static design interactive. If na your first time, finish those lessons first make you understand better.
Dis na wetin we go build:
- **Smooth drag-and-drop** for all terrarium plants
- **Coordinate tracking** make plants remember dem position
- **One full interactive interface** wey use vanilla JavaScript
- **Clean, organized code** with closure patterns
## Setting Up Your JavaScript File
Make we create di JavaScript file wey go make your terrarium interactive.
**Step 1: Create your script file**
For your terrarium folder, create new file wey dem go call `script.js`.
**Step 2: Link the JavaScript to your HTML**
Add dis script tag inside `<head>` section for your `index.html` file:
```html
<script src="./script.js" defer></script>
```
**Why `defer` attribute important:**
- **E dey make sure** your JavaScript wait till all HTML don load
- **E prevent** error wey fit happen if JavaScript find elements wey never ready
- **E guarantee** say all your plant elements dey ready for interaction
- **E dey better** pass to put scripts for page bottom
> ⚠️ **Important Note**: `defer` attribute dey stop common timing wahala. Without am, JavaScript fit try access HTML elements before dem load, wey fit cause error.
---
## Connecting JavaScript to Your HTML Elements
Before we fit make elements dey draggable, JavaScript must find dem inside di DOM. Think am like library catalog system - once you get catalog number, you go find correct book and access all inside tins.
We go use `document.getElementById()` method to do dis connection. E be like correct filing system - you give ID, e go find di exact HTML element wey you want.
### Enabling Drag Functionality for All Plants
Add dis code to your `script.js` file:
```javascript
// Make dem fit drag all di 14 plants
dragElement(document.getElementById('plant1'));
dragElement(document.getElementById('plant2'));
dragElement(document.getElementById('plant3'));
dragElement(document.getElementById('plant4'));
dragElement(document.getElementById('plant5'));
dragElement(document.getElementById('plant6'));
dragElement(document.getElementById('plant7'));
dragElement(document.getElementById('plant8'));
dragElement(document.getElementById('plant9'));
dragElement(document.getElementById('plant10'));
dragElement(document.getElementById('plant11'));
dragElement(document.getElementById('plant12'));
dragElement(document.getElementById('plant13'));
dragElement(document.getElementById('plant14'));
```
**Dis na wetin dis code dey do:**
- **E dey find** each plant element for DOM by their unique ID
- **E dey get** JavaScript reference to each HTML element
- **E dey pass** every element go `dragElement` function (wey we go create later)
- **E dey prepare** every plant for drag-and-drop interaction
- **E dey connect** your HTML structure to JavaScript work
> 🎯 **Why Use IDs Instead of Classes?** IDs dey give unique identity to specific elements, but CSS classes na for styling groups of elements. If JavaScript wan manipulate individual element, IDs get di precision and good performance.
> 💡 **Pro Tip**: You see how we dey call `dragElement()` for each plant separately? Dis approach dey make sure each plant get e own drag behavior, wey important for smooth user interaction.
### 🔄 **Pedagogical Check-in**
**DOM Connection Understanding**: Before you start drag work, make you:
- ✅ Explain how `document.getElementById()` dey find HTML elements
- ✅ Understand why we dey use unique IDs for each plant
- ✅ Talk wetin `defer` attribute mean inside script tags
- ✅ Know how JavaScript and HTML connect using DOM
**Quick Self-Test**: Wetin go happen if two elements get the same ID? Why `getElementById()` go return only one element?
*Answer: IDs suppose be unique; if dem duplicate, only first element go show*
---
## Building the Drag Element Closure
Now we go build main part of our drag functionality: one closure wey go handle dragging for each plant. Dis closure get plenty inner functions wey work together to track mouse movement and update element position.
Closures good for dis work because dem fit create "private" variables wey dey last between function calls, so each plant get e own coordinate tracking.
### Understanding Closures with a Simple Example
Make I show you closure example wey clear di idea:
```javascript
function createCounter() {
let count = 0; // Dis na like private variable
function increment() {
count++; // Di inside function dey remember di outside variable
return count;
}
return increment; // We dey give back di inside function
}
const myCounter = createCounter();
console.log(myCounter()); // 1
console.log(myCounter()); // 2
```
**Wetin dis closure dey do:**
- **E dey create** private `count` variable wey only dey inside dis closure
- **Inner function** fit access and change dat outside variable (closure way)
- **When we return** inner function, e hold connection to dat private data
- **Even after** `createCounter()` don finish, `count` still dey and remember value
### Why Closures Are Perfect for Drag Functionality
For our terrarium, each plant need remember where e dey now. Closures dey solve dis problem well:
**Key benefits for our project:**
- **E keep** private position variables for each plant alone
- **E save** coordinate data between drag events
- **E protect** variable from conflicting with other draggable elements
- **E create** clean and organized code structure
> 🎯 **Learning Goal**: You no need sabi every small thing about closures now. Just dey observe how dem help arrange code and keep state for dragging work.
```mermaid
stateDiagram-v2
[*] --> Ready: Page load
Ready --> DragStart: User press down (pointerdown)
DragStart --> Dragging: Mouse/finger dey move (pointermove)
Dragging --> Dragging: Continue to dey move
Dragging --> DragEnd: User release (pointerup)
DragEnd --> Ready: Reset for next drag
state DragStart {
[*] --> CapturePosition
CapturePosition --> SetupListeners
SetupListeners --> [*]
}
state Dragging {
[*] --> CalculateMovement
CalculateMovement --> UpdatePosition
UpdatePosition --> [*]
}
state DragEnd {
[*] --> RemoveListeners
RemoveListeners --> CleanupState
CleanupState --> [*]
}
```
### Creating the dragElement Function
Now make we build main function wey go handle all dragging logic. Add dis function under your plant element declarations:
```javascript
function dragElement(terrariumElement) {
// Start position tracking variables
let pos1 = 0, // Di mouse X position wey happen before
pos2 = 0, // Di mouse Y position wey happen before
pos3 = 0, // Di current mouse X position
pos4 = 0; // Di current mouse Y position
// Arrange di first drag event listener
terrariumElement.onpointerdown = pointerDrag;
}
```
**Understanding position tracking system:**
- **`pos1` and `pos2`**: Store difference between old and new mouse position
- **`pos3` and `pos4`**: Track current mouse coordinates
- **`terrariumElement`**: The plant element we dey make draggable
- **`onpointerdown`**: Event wey start when user begin drag
**How di closure pattern waka:**
- **E create** private position variables for every plant
- **E keep** these variables during dragging time
- **E make sure** each plant track im own coordinate independently
- **E provide** clean interface through `dragElement` function
### Why Use Pointer Events?
You fit ask why use `onpointerdown` instead of common `onclick`. See reason here:
| Event Type | Best For | The Catch |
|------------|----------|-------------|
| `onclick` | Simple button clicks | No drag support, only click and release |
| `onpointerdown` | Both mouse and touch | New but well supported now |
| `onmousedown` | Desktop mouse only | No support for mobile touch |
**Why pointer events good for our build:**
- **E work well** whether you use mouse, finger, or stylus
- **E feel same** for laptop, tablet, or phone
- **E handle** real dragging motion (no just click and finish)
- **E give** smooth experience wey modern web apps need
> 💡 **Future-Proofing**: Pointer events na modern way to handle user interaction. Instead make you write separate code for mouse and touch, you get both for free. E dey kampe, abi?
### 🔄 **Pedagogical Check-in**
**Event Handling Understanding**: Stop and check say you sabi these:
- ✅ Why we use pointer events instead of just mouse events?
- ✅ How closure variables last between function calls?
- ✅ Wetin `preventDefault()` do for smooth dragging?
- ✅ Why we attach listeners to document and not per element?
**Real-World Connection**: Think about drag-and-drop tins you dey use everyday:
- **File uploads**: Drag files enter browser window
- **Kanban boards**: Move tasks between columns
- **Image galleries**: Change photo order
- **Mobile interfaces**: Swipe and drag for touchscreen
---
## The pointerDrag Function: Capturing the Start of a Drag
When user press down for plant (with mouse click or finger touch), `pointerDrag` function go start work. Dis function capture where drag start and prepare dragging system.
Add dis function inside your `dragElement` closure, right after line `terrariumElement.onpointerdown = pointerDrag;`:
```javascript
function pointerDrag(e) {
// Make browser no do im normal tin dem (like to select text)
e.preventDefault();
// Catch di first mouse/touch position
pos3 = e.clientX; // X position wey drag begin
pos4 = e.clientY; // Y position wey drag begin
// Arrange event listeners for di drag process
document.onpointermove = elementDrag;
document.onpointerup = stopElementDrag;
}
```
**Step by step, wetin e dey do:**
- **E stop** default browser action wey fit spoil dragging
- **E record** exact place wey user start drag
- **E set up** event listener to continue drag movement
- **E prepare** system to track mouse/finger movement across whole document
### Understanding Event Prevention
Di `e.preventDefault()` line dey important for smooth dragging:
**Without dis prevention, browsers fit:**
- **Select** text wen you drag across page
- **Open** context menu on right-click drag
- **Waka interfere** with our drag behaviour
- **Create** visual disturbance during drag
> 🔍 **Experiment**: After this lesson finish, try remove `e.preventDefault()` and see wetin happen to dragging. You go sharpaly understand why e dey important!
### Coordinate Tracking System
`e.clientX` and `e.clientY` give us exact mouse/touch position:
| Property | Wetin E Mean | For Wetin E Use |
|----------|--------------|-----------------|
| `clientX` | Horizontal position relative to viewport | Track left-right movement |
| `clientY` | Vertical position relative to viewport | Track up-down movement |
**Understanding these coordinates:**
- **De give** pixel-perfect position information
- **De update** for real-time as user move dia pointer
- **De remain** consistent across different screen size dem and zoom level dem
- **De enable** smooth, responsive drag interaction
### Setting Up Document-Level Event Listeners
Notice how we attach the move and stop event dem to the whole `document`, no be only di plant element:
```javascript
document.onpointermove = elementDrag;
document.onpointerup = stopElementDrag;
```
**Why attach to the document:**
- **De continue** to track even when di mouse comot di plant element
- **De prevent** drag interruption if user move fast
- **De give** smooth dragging all over di whole screen
- **De handle** edge cases wey di cursor move outside di browser window
> ⚡ **Performance Note**: We go clean up these document-level listeners when drag stop to avoid memory leak and performance wahala.
## Completing the Drag System: Movement and Cleanup
Now we go add di two functions wey remain wey go handle di real dragging movement and di cleanup when dragging stop. These functions dey work together to create smooth, responsive plant movement inside your terrarium.
### The elementDrag Function: Tracking Movement
Add di `elementDrag` function directly after di closing curly bracket of `pointerDrag`:
```javascript
function elementDrag(e) {
// Calculate how far e don move since di last event
pos1 = pos3 - e.clientX; // Horizontal distance wey e move
pos2 = pos4 - e.clientY; // Vertical distance wey e move
// Update di current position wey we dey track
pos3 = e.clientX; // New current X position
pos4 = e.clientY; // New current Y position
// Apply di movement to di element position
terrariumElement.style.top = (terrariumElement.offsetTop - pos2) + 'px';
terrariumElement.style.left = (terrariumElement.offsetLeft - pos1) + 'px';
}
```
**Understanding the coordinate mathematics:**
- **`pos1` and `pos2`**: Calculate how far di mouse don move since di last time update
- **`pos3` and `pos4`**: Store di current mouse position for di next calculation
- **`offsetTop` and `offsetLeft`**: Get di element position for the page now now
- **Subtraction logic**: De move di element by di same amount wey di mouse move
```mermaid
sequenceDiagram
participant User
participant Mouse
participant JavaScript
participant Plant
User->>Mouse: Start drag for (100, 50)
Mouse->>JavaScript: pointerdown event
JavaScript->>JavaScript: Store initial position (pos3=100, pos4=50)
JavaScript->>JavaScript: Setup move/up listeners
User->>Mouse: Move go (110, 60)
Mouse->>JavaScript: pointermove event
JavaScript->>JavaScript: Calculate: pos1=10, pos2=10
JavaScript->>Plant: Update: left += 10px, top += 10px
Plant->>Plant: Render for new position
User->>Mouse: Release for (120, 65)
Mouse->>JavaScript: pointerup event
JavaScript->>JavaScript: Remove listeners
JavaScript->>JavaScript: Reset for next drag
```
**This na di movement calculation breakdown:**
1. **De measure** di difference between old and new mouse position dem
2. **De calculate** how much make element move based on mouse movement
3. **De update** di element CSS position properties in real-time
4. **De store** di new position as base for di next movement calculation
### Visual Representation of the Math
```mermaid
sequenceDiagram
participant Mouse
participant JavaScript
participant Plant
Mouse->>JavaScript: Move from (100,50) to (110,60)
JavaScript->>JavaScript: Calculate: move 10px right, 10px down
JavaScript->>Plant: Update position by +10px right, +10px down
Plant->>Plant: Render for new position
```
### The stopElementDrag Function: Cleaning Up
Add di cleanup function after di closing curly bracket of `elementDrag`:
```javascript
function stopElementDrag() {
// Comot di document-level event listeners
document.onpointerup = null;
document.onpointermove = null;
}
```
**Why cleanup dey important:**
- **De prevent** memory leak from event listeners wey still dey
- **De stop** di dragging action when user release di plant
- **De allow** other element dem to drag their own independently
- **De reset** di system for next drag operation
**Wetin go happen if no cleanup:**
- Event listeners go still dey run even after dragging don stop
- Performance go reduce as unused listeners go pile up
- Wahala for unexpected behavior when you interact with other element dem
- Browser resources go waste for unnecessary event handling
### Understanding CSS Position Properties
Our dragging system dey manipulate two important CSS properties:
| Property | Wetin E Control | How We Take Use Am |
|----------|-----------------|-------------------|
| `top` | Distance from top edge | Vertical positioning during drag |
| `left` | Distance from left edge | Horizontal positioning during drag |
**Key insights about offset properties:**
- **`offsetTop`**: Current distance from top of the positioned parent element
- **`offsetLeft`**: Current distance from left of the positioned parent element
- **Positioning context**: These values dey relative to the nearest positioned ancestor
- **Real-time updates**: E dey change immediately when we modify the CSS properties
> 🎯 **Design Philosophy**: This drag system na purposely flexible we no get any kind drop zones or restrictions. Users fit put their plants anywhere, give dem full creative control over their terrarium design.
## Bringing It All Together: Your Complete Drag System
Congrats! You don just build sophisticated drag-and-drop system with vanilla JavaScript. Your full `dragElement` function now get strong closure wey dey manage:
**Wetin your closure dey accomplish:**
- **De maintain** private position variables for each plant independently
- **De handle** di complete drag lifecycle from beginning to end
- **De give** smooth, responsive movement across the whole screen
- **De clean** resources well to avoid memory leaks
- **De create** intuitive, creative interface for terrarium design
### Testing Your Interactive Terrarium
Now try test your interactive terrarium! Open your `index.html` file for web browser and try di functionality:
1. **Click and hold** any plant to start to drag am
2. **Move your mouse or finger** and watch di plant dey follow smoothly
3. **Release** to drop di plant for the new position e dey
4. **Try different arrangement** to explore di interface well well
🥇 **Achievement**: You don create full interactive web app using the core concepts wey professional developers dey use every day. That drag-and-drop thing na the same principle behind file uploads, kanban board, and plenty other interactive interfaces.
### 🔄 **Pedagogical Check-in**
**Complete System Understanding**: Check if you sabi di full drag system well:
- ✅ How closures dey maintain independent state for each plant?
- ✅ Why coordinate calculation mathematics dey necessary for smooth movement?
- ✅ Wetin go happen if we forget clean up event listeners?
- ✅ How this pattern fit scale to more complex interactions?
**Code Quality Reflection**: Look your complete solution:
- **Modular design**: Each plant get im own closure instance
- **Event efficiency**: Proper setup and cleanup of listeners
- **Cross-device support**: E dey work on desktop and mobile
- **Performance conscious**: No memory leaks or unnecessary calculations
![finished terrarium](../../../../translated_images/terrarium-final.0920f16e87c13a84.pcm.png)
---
## GitHub Copilot Agent Challenge 🚀
Use Agent mode to complete this challenge:
**Description:** Improve the terrarium project by adding reset functionality wey go return all plants to their original positions with smooth animations.
**Prompt:** Create reset button wey when you click am, e go animate all plants back to their original sidebar positions using CSS transitions. The function go store the original positions when the page load and then smoothly transition plants back to those positions for 1 second when user press the reset button.
Learn more about [agent mode](https://code.visualstudio.com/blogs/2025/02/24/introducing-copilot-agent-mode) here.
## 🚀 Additional Challenge: Expand Your Skills
Ready to take your terrarium to the next level? Try add these enhancements:
**Creative Extensions:**
- **Double-click** plant to bring am come front (z-index manipulation)
- **Add visual feedback** like small glow when you hover over plants
- **Implement boundaries** so plants no go fit drag outside terrarium
- **Create save function** wey remember plant positions using localStorage
- **Add sound effects** for picking and placing plants
> 💡 **Learning Opportunity**: Each challenge go teach you new things about DOM manipulation, event handling, and user experience design.
## Post-Lecture Quiz
[Post-lecture quiz](https://ff-quizzes.netlify.app/web/quiz/20)
## Review & Self Study: Deepening Your Understanding
You don master fundamentals of DOM manipulation and closures, but still get more for explore! Here some ways to expand your knowledge and skills.
### Alternative Drag and Drop Approaches
We use pointer events for maximum flexibility, but web development get different approaches:
| Approach | Best For | Learning Value |
|----------|----------|----------------|
| [HTML Drag and Drop API](https://developer.mozilla.org/docs/Web/API/HTML_Drag_and_Drop_API) | File uploads, formal drag zones | Understanding native browser capabilities |
| [Touch Events](https://developer.mozilla.org/docs/Web/API/Touch_events) | Mobile-specific interactions | Mobile-first development patterns |
| CSS `transform` properties | Smooth animations | Performance optimization techniques |
### Advanced DOM Manipulation Topics
**Next steps for your learning journey:**
- **Event delegation**: Handle events efficiently for many elements
- **Intersection Observer**: Detect when element enter or leave viewport
- **Mutation Observer**: Watch for changes for DOM structure
- **Web Components**: Create reusable, encapsulated UI elements
- **Virtual DOM concepts**: Understand how frameworks optimize DOM updates
### Essential Resources for Continued Learning
**Technical Documentation:**
- [MDN Pointer Events Guide](https://developer.mozilla.org/docs/Web/API/Pointer_events) - Full pointer event reference
- [W3C Pointer Events Specification](https://www.w3.org/TR/pointerevents1/) - Official standards docs
- [JavaScript Closures Deep Dive](https://developer.mozilla.org/docs/Web/JavaScript/Closures) - Advanced closure patterns
**Browser Compatibility:**
- [CanIUse.com](https://caniuse.com/) - Check feature support for browsers
- [MDN Browser Compatibility Data](https://github.com/mdn/browser-compat-data) - Detailed compatibility info
**Practice Opportunities:**
- **Build** puzzle game with similar drag mechanics
- **Create** kanban board with drag-and-drop task management
- **Design** image gallery with draggable photo arrangement
- **Try** touch gesture for mobile interfaces
> 🎯 **Learning Strategy**: Best way to solidify concepts na through practice. Try build different draggable interfaces each project go teach you new thing about user interaction and DOM manipulation.
### ⚡ **What You Can Do in the Next 5 Minutes**
- [ ] Open browser DevTools and type `document.querySelector('body')` inside console
- [ ] Try change webpage text using `innerHTML` or `textContent`
- [ ] Add click event listener to any button or link on webpage
- [ ] Inspect DOM structure using Elements panel
### 🎯 **What You Can Accomplish This Hour**
- [ ] Complete post-lesson quiz and review DOM manipulation concepts
- [ ] Create interactive webpage wey respond to user clicks
- [ ] Practice event handling with different event types (click, mouseover, keypress)
- [ ] Build simple to-do list or counter with DOM manipulation
- [ ] Explore relations between HTML elements and JavaScript objects
### 📅 **Your Week-Long JavaScript Journey**
- [ ] Complete interactive terrarium project with drag-and-drop functionality
- [ ] Master event delegation for efficient event handling
- [ ] Learn about event loop and asynchronous JavaScript
- [ ] Practice closures by building modules with private state
- [ ] Explore modern DOM APIs like Intersection Observer
- [ ] Build interactive components without frameworks
### 🌟 **Your Month-Long JavaScript Mastery**
- [ ] Create complex single-page application using vanilla JavaScript
- [ ] Learn modern framework (React, Vue, or Angular) and compare to vanilla DOM
- [ ] Contribute to open source JavaScript projects
- [ ] Master advanced concepts like web components and custom elements
- [ ] Build performant web apps with optimal DOM patterns
- [ ] Teach others about DOM manipulation and JavaScript fundamentals
## 🎯 Your JavaScript DOM Mastery Timeline
```mermaid
timeline
title DOM & JavaScript Learning Progression
section Foundation (15 minutes)
DOM Understanding: Element selection methods
: Tree structure navigation
: Property access patterns
section Event Handling (20 minutes)
User Interaction: Pointer event basics
: Event listener setup
: Cross-device compatibility
: Event prevention techniques
section Closures (25 minutes)
Scope Management: Private variable creation
: Function persistence
: State management patterns
: Memory efficiency
section Drag System (30 minutes)
Interactive Features: Coordinate tracking
: Position calculation
: Movement mathematics
: Cleanup procedures
section Advanced Patterns (45 minutes)
Professional Skills: Event delegation
: Performance optimization
: Error handling
: Accessibility considerations
section Framework Understanding (1 week)
Modern Development: Virtual DOM concepts
: State management libraries
: Component architectures
: Build tool integration
section Expert Level (1 month)
Advanced DOM APIs: Intersection Observer
: Mutation Observer
: Custom Elements
: Web Components
```
### 🛠️ Your JavaScript Toolkit Summary
After you don complete this lesson, you get:
- **DOM Mastery**: Element selection, property manipulation, and tree navigation
- **Event Expertise**: Cross-device handling with pointer events
- **Closure Understanding**: Private state management and function persistence
- **Interactive Systems**: Full drag-and-drop implementation from beginning
- **Performance Awareness**: Proper event cleanup and memory management
- **Modern Patterns**: Code organization techniques used by pros
- **User Experience**: Creating intuitive, responsive interfaces
**Professional Skills You Get**: You don build features using same technique as:
- **Trello/Kanban boards**: Card dragging between columns
- **File upload systems**: Drag-and-drop file handling
- **Image galleries**: Photo arrangement interfaces
- **Mobile apps**: Touch-based interaction patterns
**Next Level**: You ready explore modern frameworks like React, Vue, or Angular wey build on these core DOM manipulation concepts!
## Assignment
[Work a bit more with the DOM](assignment.md)
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document na AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator) wey dem use translate am. Even though we dey try make am correct, abeg sabi say machine translation fit get mistake or no too correct. Di original document wey e dey for e own language na di correct one. If na important tin, better make professional human translator do am. We no go responsible if person misunderstand or get wrong idea from dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,139 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "947ca5ce7c94aee9c7de7034e762bc17",
"translation_date": "2026-01-08T19:04:56+00:00",
"source_file": "3-terrarium/3-intro-to-DOM-and-closures/assignment.md",
"language_code": "pcm"
}
-->
# DOM Element Investigation Assignment
## Overview
Now wey you don experience the power of DOM manipulation for yourself, na time to explore the bigger world of DOM interfaces. Dis assignment go deepen your understanding of how different web technologies dey interact with the DOM beyond just dragging elements.
## Learning Objectives
By completing dis assignment, you go:
- **Research** and sabi one specific DOM interface well-well
- **Analyze** how people dey use DOM manipulation for real life
- **Connect** theory concepts to practical tins wey fit work
- **Develop** skills for technical documentation and analysis
## Instructions
### Step 1: Choose Your DOM Interface
Go check MDN full [list of DOM interfaces](https://developer.mozilla.org/docs/Web/API/Document_Object_Model) and choose one interface wey you like. Try choose from these categories make e get variety:
**Beginner-Friendly Options:**
- `Element.classList` - How to manage CSS classes small-small
- `Document.querySelector()` - Advanced way to select elements
- `Element.addEventListener()` - How to manage events pass pointer events
- `Window.localStorage` - Where you fit store data for client side
**Intermediate Challenges:**
- `Intersection Observer API` - How to detect if element dey visible
- `MutationObserver` - How to watch DOM changes
- `Drag and Drop API` - Another way to do pointer based dragging
- `Geolocation API` - How to get user location
**Advanced Exploration:**
- `Web Components` - Custom elements plus shadow DOM
- `Canvas API` - How to do graphics programmatic
- `Web Workers` - Work for background without disturbing UI
- `Service Workers` - How to make offline functions
### Step 2: Research and Document
Make one deep analysis (300-500 words) wey include:
#### Technical Overview
- **Define** wetin your chosen interface dey do for a simple, beginner-friendly way
- **Explain** the main methods, properties, or events wey e get
- **Describe** the kind problems wey e dey solve
#### Real-World Implementation
- **Find** website wey use your chosen interface (fit inspect the code or research examples)
- **Document** how dem take implement am with code samples if you fit
- **Analyze** why the developers choose that style
- **Explain** how e make user experience beta
#### Practical Application
- **Compare** your interface with the techniques we use last time for the terrarium project
- **Suggest** how your interface fit improve or add beta tins for terrarium
- **Identify** other projects wey dis interface go make sense
### Step 3: Code Example
Put one simple, working code wey go show your interface in action. E suppose be:
- **Functional** - The code go really work if you test am
- **Commented** - Make e explain wetin each part dey do
- **Relevant** - Make e connect to real-life use case
- **Beginner-friendly** - People wey dey learn web dev go fit understand am
## Submission Format
Structure your write-up with clear headings:
```markdown
# [Interface Name] DOM Investigation
## What It Does
[Technical overview]
## Real-World Example
[Website analysis and implementation details]
## Code Demonstration
[Your working example with comments]
## Reflection
[How this connects to our terrarium project and future applications]
```
## Assessment Rubric
| Criteria | Exemplary (A) | Proficient (B) | Developing (C) | Needs Improvement (D) |
|----------|---------------|----------------|----------------|----------------------|
| **Technical Understanding** | Show deep understanding with correct explanations and proper terms | Show solid understanding with mostly correct explanations | Basic understanding but get small mistakes | No good understanding plus plenty errors |
| **Real-World Analysis** | Identify and analyze real implementation well well with examples | Find real example with okay analysis | Find example but analysis no too deep | Vague or wrong real-world connection |
| **Code Example** | Code wey work plus good comments to show how interface work | Working code with enough comments | Code dey work but need better explanation | Code get errors or explanation no clear |
| **Writing Quality** | Clear, interesting writing with proper structure and technical talk | Well organized with good technical writing | Adequate organization and clarity | No good organization or unclear writing |
| **Critical Thinking** | Make clever connections between ideas and suggest new ways to use interface | Show good thinking plus relevant connections | Small analysis but fit still do more | No much sign of thinking critically |
## Tips for Success
**Research Strategies:**
- **Start** with MDN docs to get correct information
- **Look** for code examples on GitHub or CodePen
- **Check** popular websites using browser dev tools
- **Watch** tutorial videos to see explanations visually
**Writing Guidelines:**
- **Use** your own words, no copy-paste from docs
- **Include** examples and code snippets wey fit explain well
- **Explain** technical things like you dey teach friend
- **Connect** your interface to general web dev concepts
**Code Example Ideas:**
- **Create** small demo wey show main features of your interface
- **Build** on ideas from our terrarium project if e fit
- **Focus** on how e work pass how e look
- **Test** your code to make sure e work well
## Submission Deadline
[Insert deadline here]
## Questions?
If you no understand any part of this assignment, no fear to ask! Dis investigation go deepen your knowledge of how DOM dey power the interactive web we dey use everyday.
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document dem don use AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator) translate am. Even though we try make am correct, abeg know say automated translation fit get some mistake or no too correct. The original document wey e write for im own language na im be the correct source. If na serious matter, e better make person wey sabi do professional human translation check am. We no go responsible if person no understand well or if dem misunderstand because of this translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,30 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "bc5c5550f79d10add90ce419ee34abb3",
"translation_date": "2026-01-08T11:36:15+00:00",
"source_file": "3-terrarium/README.md",
"language_code": "pcm"
}
-->
## Deploy your Terrarium
You fit deploy, or publish your Terrarium for the web using **Azure Static Web Apps**.
1. Fork dis repo
2. Press dis button 👇
[![Deploy to Azure](https://aka.ms/deploytoazurebutton)](https://portal.azure.com/#create/Microsoft.StaticApp)
3. Follow the setup wizard to create your app.
- Set the **App root** to either `/solution` or the root of your codebase.
- Their no API for this app, so you fit skip the API configuration.
- A `.github` folder go automatically create to help Azure Static Web Apps build and publish your app.
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document na AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator) wey translate am. Even though we dey try make am correct, abeg sabi say automated translation fit get some errors or wahala. Di original document wey e original language na di main correct one. For important tori, make person wey sabi human translator do am. We no go take blame if person no understand or if e use dis translation do wrong meaning.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,41 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "6329fbe8bd936068debd78cca6f09c0a",
"translation_date": "2026-01-08T19:09:12+00:00",
"source_file": "3-terrarium/solution/README.md",
"language_code": "pcm"
}
-->
# My Terrarium: A project to learn about HTML, CSS, and DOM manipulation using JavaScript 🌵🌱
Na small drag and drop code-meditation. Wit small HTML, JS and CSS, you fit build web interface, style am, and add interaction.
![my terrarium](../../../../translated_images/screenshot_gray.0c796099a1f9f25e.pcm.png)
## Credits
E write wit ♥️ by [Jen Looper](https://www.twitter.com/jenlooper)
Di terrarium wey CSS build na Jakub Mandra glass jar [codepen](https://codepen.io/Rotarepmi/pen/rjpNZY) inspire am.
Di artwork na wetin [Jen Looper](http://jenlooper.com) draw by hand wit Procreate.
## Deploy your Terrarium
You fit deploy, or publish your terrarium for web wit Azure Static Web Apps.
1. Fork dis repo
2. Press dis button
[![Deploy to Azure button](https://aka.ms/deploytoazurebutton)](https://portal.azure.com/?feature.customportal=false&WT.mc_id=academic-77807-sagibbon#create/Microsoft.StaticApp)
3. Follow di wizard create your app. Make sure say you set di app root to either be `/solution` or root of your codebase. Di app no get API, so no worry about to add am. .github folder go create for your forked repo wey go help Azure Static Web Apps build service build and publish your app to new URL.
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document don translate wit AI translation service wey dem dey call [Co-op Translator](https://github.com/Azure/co-op-translator). Even though we dey try make am correct, abeg sabi say machine translation fit get mistakes or no too correct well well. Di original document wey dey im own language na di real correct source. For important info, e better make human professional translate am. We no go responsible if person misunderstand or mistake any from dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,290 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "efa2ab875b8bb5a7883816506da6b6d2",
"translation_date": "2026-01-08T11:31:16+00:00",
"source_file": "4-typing-game/README.md",
"language_code": "pcm"
}
-->
# Event-Driven Programming - Build a Typing Game
```mermaid
journey
title Your Typing Game Development Journey
section Foundation
Plan game structure: 3: Student
Design user interface: 4: Student
Setup HTML elements: 4: Student
section Functionality
Handle user input: 4: Student
Track timing: 5: Student
Calculate accuracy: 5: Student
section Features
Add visual feedback: 5: Student
Implement game logic: 5: Student
Polish experience: 5: Student
```
## Introduction
Dis na wetin every developer sabi but no dey talk about well-well: typing fast na big power! 🚀 Think am - di faster wey you fit commot your tins from your brain go your code editor, di more your creativity go flow. E be like say you get direct pipeline between your mind and di screen.
```mermaid
pie title Game Features
"Real-time Feedback" : 25
"Performance Tracking" : 20
"Interactive UI" : 20
"Timer System" : 15
"Quote Management" : 10
"Results Display" : 10
```
You wan sabi one beta way to upgrade dis skill? You don guess am - we go build game!
```mermaid
flowchart LR
A[Player start di game] --> B[Random quote show]
B --> C[Player dey type characters]
C --> D{Character correct?}
D -->|Yes| E[Green highlight]
D -->|No| F[Red highlight]
E --> G[Update accuracy]
F --> G
G --> H{Quote finish?}
H -->|No| C
H -->|Yes| I[Calculate WPM]
I --> J[Show result]
J --> K[Play again?]
K -->|Yes| B
K -->|No| L[Game don finish]
style A fill:#e1f5fe
style D fill:#fff3e0
style E fill:#e8f5e8
style F fill:#ffebee
style I fill:#f3e5f5
```
> Make we create beta typing game together!
You ready to put all those JavaScript, HTML, and CSS skills wey you don dey learn for work? We go build typing game wey go challenge you with random quotes from di legendary detective [Sherlock Holmes](https://en.wikipedia.org/wiki/Sherlock_Holmes). Di game go dey track how fast and correct you fit type - and I swear, e dey more addictive pass wetin you fit think!
```mermaid
mindmap
root((Typing Game Development))
User Interface
Input Elements
Visual Feedback
Responsive Design
Accessibility
Game Logic
Quote Selection
Timer Management
Accuracy Tracking
Score Calculation
Event Handling
Keyboard Input
Button Clicks
Real-time Updates
Game State Changes
Performance Metrics
Words Per Minute
Character Accuracy
Error Tracking
Progress Display
User Experience
Immediate Feedback
Clear Instructions
Engaging Content
Achievement System
```
![demo](../../../4-typing-game/images/demo.gif)
## Wetin You Need to Know
```mermaid
flowchart TD
A[User Action] --> B{Event Type?}
B -->|Key Press| C[Keyboard Event]
B -->|Button Click| D[Mouse Event]
B -->|Timer| E[Time Event]
C --> F[Check Character]
D --> G[Start/Reset Game]
E --> H[Update Timer]
F --> I{Correct?}
I -->|Yes| J[Highlight Green]
I -->|No| K[Highlight Red]
J --> L[Update Score]
K --> L
L --> M[Check Game State]
G --> N[Generate New Quote]
H --> O[Display Time]
M --> P{Game Complete?}
P -->|Yes| Q[Show Results]
P -->|No| R[Continue Game]
style A fill:#e1f5fe
style F fill:#e8f5e8
style I fill:#fff3e0
style Q fill:#f3e5f5
```
Before we start, make sure say you sabi these tins well (no shaking if you need quick refresher - we all don pass dat one!):
- How to create text input and button controls
- CSS and how to set styles with classes
- JavaScript basics
- How to create array
- How to create random number
- How to get current time
If any of this tins dey small rusty for you, no worry! Sometimes di beta way to make your knowledge strong na to jump inside project and learn as you dey go.
### 🔄 **Pedagogical Check-in**
**Foundation Assessment**: Before you start development, make sure say you sabi:
- ✅ How HTML forms and input elements dey work
- ✅ CSS classes and dynamic styling
- ✅ JavaScript event listeners and handlers
- ✅ Array manipulation and random selection
- ✅ How to measure time and do calculations
**Quick Self-Test**: Fit explain how these concepts dey work together for interactive game?
- **Events** dey trigger when users interact with elements
- **Handlers** dey process those events and update game state
- **CSS** dey give visual feedback for user actions
- **Timing** dey enable performance measurement and game progress
```mermaid
quadrantChart
title Typing Game Skills Development
x-axis Beginner --> Expert
y-axis Static --> Interactive
quadrant-1 Advanced Games
quadrant-2 Real-time Apps
quadrant-3 Basic Pages
quadrant-4 Interactive Sites
HTML Forms: [0.3, 0.2]
CSS Styling: [0.4, 0.3]
Event Handling: [0.7, 0.8]
Game Logic: [0.8, 0.9]
Performance Tracking: [0.9, 0.7]
```
## Make We Build Dis Game!
[Creating a typing game by using event driven programming](./typing-game/README.md)
### ⚡ **Wetin You Fit Do for Next 5 Minutes**
- [ ] Open your browser console and try listen for keyboard events with `addEventListener`
- [ ] Create simple HTML page with input field and test typing detection
- [ ] Practice string manipulation by comparing typed text with target text
- [ ] Try use `setTimeout` to understand timing functions
### 🎯 **Wetin You Fit Achieve Dis Hour**
- [ ] Finish post-lesson quiz and understand event-driven programming
- [ ] Build basic version of typing game with word validation
- [ ] Add visual feedback for correct and wrong typing
- [ ] Implement simple scoring system wey depend on speed and accuracy
- [ ] Style your game with CSS to make am look fine
### 📅 **Your Week-Long Game Development**
- [ ] Finish full typing game with all features and polish
- [ ] Add difficulty levels with different word complexity
- [ ] Implement user statistics tracking (WPM, accuracy over time)
- [ ] Create sound effects and animations for better user experience
- [ ] Make your game mobile-responsive for touch devices
- [ ] Share your game online and collect feedback from users
### 🌟 **Your Month-Long Interactive Development**
- [ ] Build multiple games to explore different interaction patterns
- [ ] Learn about game loops, state management, and performance optimization
- [ ] Contribute to open source game development projects
- [ ] Master advanced timing concepts and smooth animations
- [ ] Create portfolio wey dey show different interactive applications
- [ ] Mentor people wey dey interested in game development and user interaction
## 🎯 Your Typing Game Mastery Timeline
```mermaid
timeline
title Game Development Learning Progression
section Setup (10 minutes)
Project Structure: HTML foundation
: CSS styling setup
: JavaScript file creation
section User Interface (20 minutes)
Interactive Elements: Input fields
: Button controls
: Display areas
: Responsive layout
section Event Handling (25 minutes)
User Interaction: Keyboard events
: Mouse events
: Real-time feedback
: State management
section Game Logic (30 minutes)
Core Functionality: Quote generation
: Character comparison
: Accuracy calculation
: Timer implementation
section Performance Tracking (35 minutes)
Metrics & Analytics: WPM calculation
: Error tracking
: Progress visualization
: Results display
section Polish & Enhancement (45 minutes)
User Experience: Visual feedback
: Sound effects
: Animations
: Accessibility features
section Advanced Features (1 week)
Extended Functionality: Difficulty levels
: Leaderboards
: Custom quotes
: Multiplayer options
section Professional Skills (1 month)
Game Development: Performance optimization
: Code architecture
: Testing strategies
: Deployment patterns
```
### 🛠️ Your Game Development Toolkit Summary
After you finish dis project, you go sabi:
- **Event-Driven Programming**: Responsive user interfaces wey dey react to input
- **Real-Time Feedback**: Instant visual and performance updates
- **Performance Measurement**: Correct timing and scoring systems
- **Game State Management**: Control application flow and user experience
- **Interactive Design**: Create engaging, addictive user experiences
- **Modern Web APIs**: Use browser capabilities for rich interactions
- **Accessibility Patterns**: Inclusive design for everybody
**Real-World Applications**: These skills dey important for:
- **Web Applications**: Any interactive interface or dashboard
- **Educational Software**: Learning platforms and skill assessment tools
- **Productivity Tools**: Text editors, IDEs, and collaboration software
- **Gaming Industry**: Browser games and interactive entertainment
- **Mobile Development**: Touch-based interfaces and gesture handling
**Next Level**: You ready to explore advanced game frameworks, real-time multiplayer systems, or complex interactive applications!
## Credits
Written with ♥️ by [Christopher Harrison](http://www.twitter.com/geektrainer)
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis dokumment don translate wit AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator). Even though we dey try make am correct, abeg make you sabi se automated translation fit get some error or mistake. Di original dokumment wey dey dia for im own language na im be di main correct source. For important info, na professional human translation you suppose use. We no go responsible for any kind konfussion or wrong understandin wey fit happen from dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,17 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "068cbb9b3c10a96d503f6cdd6c9ace8c",
"translation_date": "2026-01-08T18:07:39+00:00",
"source_file": "4-typing-game/solution/README.md",
"language_code": "pcm"
}
-->
Dis na placeholder, left blank on purpose.
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis dokument don translate wit AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator). Even tho we dey try make am correct, abeg sabi say automated translation fit get some errors or mistake. Di original dokument wey dey dia for im correct language na di correct source. If na serious info, e better make person wey sabi translate am do am. We no go responsible for any wahala or misunderstanding wey fit come from dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,612 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "da8bc72041a2bb3826a54654ee1a8844",
"translation_date": "2026-01-08T18:08:21+00:00",
"source_file": "4-typing-game/typing-game/README.md",
"language_code": "pcm"
}
-->
# Creating a game using events
You don waka ever wonder how websites sabi when you click button or type for inside textbox? Na the magic wey dey inside event-driven programming! Wetin better way to learn dis important skill than to build something useful - typing speed game wey dey react to every keystroke wey you do.
You go see for yourself how web browsers dey "talk" to your JavaScript code. Every time you click, type, or move your mouse, the browser dey send small messages (we dey call dem events) go your code, and na you go decide how to respond!
By the time we finish here, you go don build real typing game wey dey track your speed and accuracy. More importantly, you go understand the fundamental concepts wey dey power every interactive website wey you don ever use. Make we dive inside!
## Pre-Lecture Quiz
[Pre-lecture quiz](https://ff-quizzes.netlify.app/web/quiz/21)
## Event driven programming
Think about your favorite app or website - wetin make am feel alive and responsive? Na everything about how e dey react to wetin you do! Every tap, click, swipe, or keystroke na wetin we dey call "event," and na there the real magic of web development dey happen.
This na wetin make programming for web dey interesting: we no sabi when person go click that button or begin type for inside textbox. E fit click immediately, wait five minutes, or maybe no click at all! This unpredictability mean say we need to think differently on top how we dey write our code.
Instead of writing code wey go run from top to bottom like recipe, we dey write code wey just siddon wait patiently for something to happen. E be like how telegraph operators for 1800s dey siddon near their machines, ready to respond the moment message show for the wire.
So wetin be "event"? Simply put, na wetin happen! When you click button - na event be dat. When you type letter - na event be dat. When you move your mouse - na another event be dat.
Event-driven programming let us set our code to listen and respond. We dey create special functions wey we dey call **event listeners** wey go wait patiently for specific things to happen, then come rush into action when dem happen.
Think event listeners as doorbell for your code. You set the doorbell (`addEventListener()`), tell am which sound to listen for (like 'click' or 'keypress'), then specify wetin suppose happen when person ring am (your own custom function).
**Dis na how event listeners dey work:**
- **Listen** for specific user actions like clicks, keystrokes, or mouse movements
- **Run** your custom code when the specified event happen
- **Respond** immediately to user interactions, create smooth experience
- **Handle** multiple events on same element using different listeners
> **NOTE:** E good to know say plenty ways dey to create event listeners. You fit use anonymous functions, or create named ones. You fit use different shortcuts, like to set `click` property, or to use `addEventListener()`. For our exercise, we go focus on `addEventListener()` and anonymous functions, as na the most common way web developers dey use. E get plenty flexibility too, as `addEventListener()` dey work with all events, and event name fit dey passed as parameter.
### Common events
Even though web browsers get plenty different events wey you fit listen to, most interactive apps rely on just few important events. To sabi these main events go give you foundation to build better user interactions.
You get [dozens of events](https://developer.mozilla.org/docs/Web/Events) wey you fit listen for when you dey create app. Basically anything wey user do on page go raise event, this one dey give you plenty power to make sure dem get the experience you want. Luckily, you go normally need only small handful of events. Here some common ones (including the two we go use for making our game):
| Event | Description | Common Use Cases |
|-------|-------------|------------------|
| `click` | User click on something | Buttons, links, interactive elements |
| `contextmenu` | User click right mouse button | Custom right-click menus |
| `select` | User highlight some text | Text editing, copy operations |
| `input` | User input some text | Form validation, real-time search |
**To understand these event types:**
- **Trigger** when users interact with specific elements on your page
- **Provide** detailed info about user's action through event objects
- **Enable** you to create responsive, interactive web apps
- **Work** consistently across different browsers and devices
## Creating the game
Now wey you don understand how events dey work, make we take that knowledge put am for practice by building something useful. We go create typing speed game wey go show how event handling dey work and help you develop important developer skill.
We go create game to explore how events dey work for JavaScript. Our game go test player typing skill which be one of the most underrated skills wey all developers suppose get. Fun fact: the QWERTY keyboard layout wey we use today na im dem design for typewriters back for 1870s - and good typing skill still dey very valuable for programmers today! The general flow of the game go be like this:
```mermaid
flowchart TD
A[Player click Start] --> B[Random quote show]
B --> C[Player dey type for textbox]
C --> D{Word finish?}
D -->|Yes| E[Highlight di next word]
D -->|No| F{E correct so far?}
F -->|Yes| G[Make style normal]
F -->|No| H[Show error style]
E --> I{Quote finish?}
I -->|No| C
I -->|Yes| J[Show success message with time]
G --> C
H --> C
```
**Here na how our game go work:**
- **Start** when player click start button and display random quote
- **Track** player typing progress word by word in real-time
- **Highlight** the current word to guide player focus
- **Provide** immediate visual feedback for typing errors
- **Calculate** and display the total time when the quote complete
Make we build our game, and learn more about events!
### File structure
Before we start to code, make we organize ourselves! To get clean file structure from the beginning go save headache later and make your project look professional. 😊
We go keep am simple with just three files: `index.html` for page structure, `script.js` for all our game logic, and `style.css` to make everything fine. Dis na classic trio wey dey power most web!
**Create new folder for your work by opening console or terminal and run dis command:**
```bash
# Linux or macOS
mkdir typing-game && cd typing-game
# Windows
md typing-game && cd typing-game
```
**Here na wetin these commands go do:**
- **Create** new directory wey dem call `typing-game` for your project files
- **Goto** the newly created directory automatically
- **Set** clean workspace for your game development
**Open Visual Studio Code:**
```bash
code .
```
**Dis command:**
- **Launch** Visual Studio Code for current directory
- **Open** your project folder inside editor
- **Provide** access to all development tools wey you go need
**Add three files to the folder inside Visual Studio Code with these names:**
- `index.html` - get structure and content of your game
- `script.js` - handle all game logic and event listeners
- `style.css` - define visual look and styling
## Create the user interface
Now make we build the stage where all our game action go happen! Think am like to design control panel for spaceship - we need make sure everything wey our players need dey for place wey dem expect.
Make we think wetin our game really need. If na you dey play typing game, wetin you go want see for the screen? Here na wetin we go need:
| UI Element | Purpose | HTML Element |
|------------|---------|-------------|
| Quote Display | Show the text to type | `<p>` with `id="quote"` |
| Message Area | Show status and success messages | `<p>` with `id="message"` |
| Text Input | Where players type the quote | `<input>` with `id="typed-value"` |
| Start Button | Begin the game | `<button>` with `id="start"` |
**Understanding the UI structure:**
- **Organize** content logically from top to bottom
- **Assign** unique IDs to elements for JavaScript targeting
- **Provide** clear visual hierarchy for better user experience
- **Include** semantic HTML elements for accessibility
Each one go need ID so that we fit work with dem inside our JavaScript. We go also add reference to CSS and JavaScript files wey we go create.
Create new file wey dem go call `index.html`. Add this HTML:
```html
<!-- inside index.html -->
<html>
<head>
<title>Typing game</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1>Typing game!</h1>
<p>Practice your typing skills with a quote from Sherlock Holmes. Click **start** to begin!</p>
<p id="quote"></p> <!-- This will display our quote -->
<p id="message"></p> <!-- This will display any status messages -->
<div>
<input type="text" aria-label="current word" id="typed-value" /> <!-- The textbox for typing -->
<button type="button" id="start">Start</button> <!-- To start the game -->
</div>
<script src="script.js"></script>
</body>
</html>
```
**Explain what this HTML structure fit do:**
- **Link** the CSS stylesheet inside `<head>` for styling
- **Create** clear heading and instructions for users
- **Establish** placeholder paragraphs with specific IDs for dynamic content
- **Include** input field with accessibility attributes
- **Provide** start button to start the game
- **Load** JavaScript file at the end for better performance
### Launch the application
Testing your application frequently while you dey develop go help you catch problems early and see your progress in real-time. Live Server na valuable tool wey go automatically refresh your browser anytime you save changes, this one make development better.
E good to develop little by little so you fit see how things dey look. Make we launch our application. There a great extension for Visual Studio Code called [Live Server](https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer&WT.mc_id=academic-77807-sagibbon) wey go host your application locally and also refresh the browser whenever you save.
**Install [Live Server](https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer&WT.mc_id=academic-77807-sagibbon) by following the link and click Install:**
**Here na wetin go happen during installation:**
- **Tell** your browser to open Visual Studio Code
- **Guide** you through the extension installation process
- **Fit require** restart Visual Studio Code to finish setup
**When e don install, for Visual Studio Code, press Ctrl-Shift-P (or Cmd-Shift-P) to open command palette:**
**Understanding the command palette:**
- **Give** quick access to all VS Code commands
- **Search** commands as you type
- **Give** keyboard shortcuts for faster development
**Type "Live Server: Open with Live Server":**
**Wetn Live Server dey do:**
- **Start** local development server for your project
- **Automatically** refresh browser when you save files
- **Serve** your files from local URL (usually `localhost:5500`)
**Open browser and go `https://localhost:5500`:**
You suppose see the page you create! Make we add some functionality.
## Add the CSS
Now make we make things fine! Visual feedback don dey important for user interfaces since early days of computing. For 1980s, researchers discover say immediate visual feedback really improve user performance and reduce mistakes. Na exactly wetin we go create here.
Our game need make e clear well well wetin dey happen. Players suppose know immediately which word to type, and if dem make mistake, dem go see am immediately. Make we create simple but effective styling:
Create new file wey you call `style.css` and put dis syntax inside.
```css
/* inside style.css */
.highlight {
background-color: yellow;
}
.error {
background-color: lightcoral;
border: red;
}
```
**Understanding these CSS classes:**
- **Highlight** the current word with yellow background to give clear visual guidance
- **Show** typing errors with light coral background color
- **Provide** immediate feedback without disturbing user typing flow
- **Use** contrasting colors for accessibility and clear visual communication
✅ For CSS, you fit arrange your page any how you like. Take small time and make the page fine:
- Pick different font
- Color the headers
- Resize items
## JavaScript
Now na here things go start dey interesting! 🎉 We get our HTML structure and CSS styling, but now our game be like beautiful car wey no get engine. JavaScript na that engine - na im dey make everything really work and respond to wetin players do.
Na here you go see your creation come to life. We go do am step by step so e no go too heavy:
| Step | Purpose | Wetin You Go Learn |
|------|---------|------------------|
| [Create the constants](../../../../4-typing-game/typing-game) | Set up quotes and DOM references | Variable management and DOM selection |
| [Event listener to start the game](../../../../4-typing-game/typing-game) | Handle game initialization | Event handling and UI updates |
| [Event listener to typing](../../../../4-typing-game/typing-game) | Process user input in real-time | Input validation and dynamic feedback |
**Dis structured approach go help you:**
- **Organize** your code into logical, manageable parts
- **Build** functionality step by step to make debugging easy
- **Understand** how different parts of app dey work together
- **Create** reusable patterns for future projects
But first, create new file wey you go call `script.js`.
### Add the constants
Before we enter action, make we gather all our resources! Just like NASA mission control wey set all their monitoring systems before launch, e dey easier when you get everything ready. This go save us from to dey find things later and help make we no make typos.
Here na wetin we need set up first:
| Data Type | Purpose | Example |
| Array of quotes | Store all possible quotes for the game | `['Quote 1', 'Quote 2', ...]` |
| Word array | Break current quote into individual words | `['When', 'you', 'have', ...]` |
| Word index | Track which word player is typing | `0, 1, 2, 3...` |
| Start time | Calculate elapsed time for scoring | `Date.now()` |
**We go still need references to our UI elements:**
| Element | ID | Purpose |
|---------|----|---------|
| Text input | `typed-value` | Where players go type |
| Quote display | `quote` | Shows the quote to type |
| Message area | `message` | Displays status updates |
```javascript
// inside script.js
// all of our quotes
const quotes = [
'When you have eliminated the impossible, whatever remains, however improbable, must be the truth.',
'There is nothing more deceptive than an obvious fact.',
'I ought to know by this time that when a fact appears to be opposed to a long train of deductions it invariably proves to be capable of bearing some other interpretation.',
'I never make exceptions. An exception disproves the rule.',
'What one man can invent another can discover.',
'Nothing clears up a case so much as stating it to another person.',
'Education never ends, Watson. It is a series of lessons, with the greatest for the last.',
];
// store di list of words and di index of di word wey di player dey type now
let words = [];
let wordIndex = 0;
// di starting time
let startTime = Date.now();
// page elements
const quoteElement = document.getElementById('quote');
const messageElement = document.getElementById('message');
const typedValueElement = document.getElementById('typed-value');
```
**Breaking down wetin dis setup code dey do:**
- **Stores** array of Sherlock Holmes quotes with `const` because quotes no go change
- **Initializes** tracking variables with `let` as dem go dey update during gameplay
- **Captures** references to DOM elements using `document.getElementById()` for better access
- **Sets up** ground for all game functionality with clear, descriptive variable names
- **Organizes** related data and elements make e easy to maintain code
✅ Go ahead add more quotes to your game
> 💡 **Pro Tip**: We fit retrieve elements anytime for code by using `document.getElementById()`. Since we go dey refer these elements anyhow, we go avoid typos with string literals by using constants. Frameworks like [Vue.js](https://vuejs.org/) or [React](https://reactjs.org/) fit help you manage centralizing your code better.
>
**Na why dis approach dey work so well:**
- **Prevents** spelling mistakes when you dey refer elements many times
- **Improves** code clarity with descriptive constant names
- **Enables** better IDE support with autocomplete and error checking
- **Makes** am easier to refactor if element IDs change later
Take small time watch video on top using `const`, `let` and `var`
[![Types of variables](https://img.youtube.com/vi/JNIXfGiDWM8/0.jpg)](https://youtube.com/watch?v=JNIXfGiDWM8 "Types of variables")
> 🎥 Click the picture above for video about variables.
### Add start logic
Na here everything go begin work! 🚀 You dey about write your first true event listener, and e dey satisfy to see your code respond when person click button.
Think am well: somewhere, player go click that "Start" button, and your code must ready for am. We no know when dem go click am - fit be immediately, fit be after dem grab coffee - but when dem do am, your game go start live.
When user click `start`, we go pick quote, setup user interface, then setup tracking for current word and time. Below na the JavaScript you need add; we go explain am just after the script block.
```javascript
// for di end of script.js
document.getElementById('start').addEventListener('click', () => {
// make we find one quote
const quoteIndex = Math.floor(Math.random() * quotes.length);
const quote = quotes[quoteIndex];
// Put di quote inside one array of words
words = quote.split(' ');
// reset di word index so we fit track am
wordIndex = 0;
// UI dey update
// Make array of span things so we fit set class
const spanWords = words.map(function(word) { return `<span>${word} </span>`});
// Change am to string and put am as innerHTML for di quote display
quoteElement.innerHTML = spanWords.join('');
// Make di first word clear pass di others
quoteElement.childNodes[0].className = 'highlight';
// Clear any kain message wey dey before
messageElement.innerText = '';
// Arrange di textbox
// Clear di textbox
typedValueElement.value = '';
// put focus
typedValueElement.focus();
// put di event handler
// Start di timer
startTime = new Date().getTime();
});
```
**Make we break down the code into sections:**
**📊 Word Tracking Setup:**
- **Selects** random quote using `Math.floor()` and `Math.random()` for variety
- **Converts** quote into array of individual words using `split(' ')`
- **Resets** `wordIndex` to 0 because players start with first word
- **Prepares** game state for fresh round
**🎨 UI Setup and Display:**
- **Creates** array of `<span>` elements, wrap each word for separate styling
- **Joins** span elements into one string for efficient DOM update
- **Highlights** first word by adding `highlight` CSS class
- **Clears** any past game messages to provide clean slate
**⌨️ Textbox Preparation:**
- **Clears** any existing text inside input
- **Sets focus** to textbox so players go start type immediately
- **Prepares** input area for new game session
**⏱️ Timer Initialization:**
- **Captures** current timestamp with `new Date().getTime()`
- **Enables** accurate calculation of typing speed and completion time
- **Starts** performance tracking for game session
### Add typing logic
Na here we dey take handle the heart of our game! No worry if e look complicated at first - we go waka through every part, and by the end, you go see how e dey logical.
Wetin we dey build here na serious: every time person type letter, our code go check wetin dem type, give dem feedback, and decide wetin go happen next. Na like those old word processors like WordStar from 1970s wey dey give typists real-time feedback.
```javascript
// for di end of script.js
typedValueElement.addEventListener('input', () => {
// make you get di current word
const currentWord = words[wordIndex];
// make you get di current value
const typedValue = typedValueElement.value;
if (typedValue === currentWord && wordIndex === words.length - 1) {
// end of di sentence
// show success
const elapsedTime = new Date().getTime() - startTime;
const message = `CONGRATULATIONS! You finished in ${elapsedTime / 1000} seconds.`;
messageElement.innerText = message;
} else if (typedValue.endsWith(' ') && typedValue.trim() === currentWord) {
// end of di word
// clear di typedValueElement for di new word
typedValueElement.value = '';
// move go di next word
wordIndex++;
// make reset di class name for all di elements wey dey quote
for (const wordElement of quoteElement.childNodes) {
wordElement.className = '';
}
// highlight di new word
quoteElement.childNodes[wordIndex].className = 'highlight';
} else if (currentWord.startsWith(typedValue)) {
// correct so far
// highlight di next word
typedValueElement.className = '';
} else {
// error state
typedValueElement.className = 'error';
}
});
```
**Understanding the typing logic flow:**
This function dey use waterfall style, checking conditions from most specific go most general. Make we break am down for each scenario:
```mermaid
flowchart TD
A[Player types character] --> B[Get current word and typed value]
B --> C{Quote complete?}
C -->|Yes| D[Show completion message with time]
C -->|No| E{Word complete with space?}
E -->|Yes| F[Clear input, move to next word, update highlight]
E -->|No| G{Typing correctly so far?}
G -->|Yes| H[Remove error styling]
G -->|No| I[Show error styling]
```
**🏁 Quote Complete (Scenario 1):**
- **Checks** if typed value match current word AND we dey for last word
- **Calculates** elapsed time by subtracting start time from current time
- **Converts** milliseconds to seconds by dividing by 1,000
- **Displays** congratulatory message wit completion time
**✅ Word Complete (Scenario 2):**
- **Detects** word complete when input end wit space
- **Validates** say trimmed input match current word exactly
- **Clears** input field for next word
- **Advances** to next word by incrementing `wordIndex`
- **Updates** visual highlighting by removing all classes then highlight new word
**📝 Typing in Progress (Scenario 3):**
- **Verifies** say current word start wit wetin dem type so far
- **Removes** any error styling show say input correct
- **Allows** continued typing without wahala
**❌ Error State (Scenario 4):**
- **Triggers** when typed text no match the expected word beginning
- **Applies** error CSS class for immediate visual feedback
- **Helps** players quickly spot and correct mistake
## Test your application
Look wetin you don achieve! 🎉 You build real, working typing game from scratch using event-driven programming. Take time appreciate that - na no small thing be that!
Now na testing phase come! E go work as we expect? We miss anything? Wetin dey happen be say if e no work perfectly immediately, no wahala. Even top developers dey find bugs for their code sometimes. Na part of development process be that!
Click `start`, den start to type! E go look small like the animation we see before.
![Animation of the game in action](../../../../4-typing-game/images/demo.gif)
**Wetin to test for your application:**
- **Verifies** say clicking Start go show random quote
- **Confirms** typing go highlight current word correct
- **Checks** that error styling show up for wrong typing
- **Ensures** say completing words go move highlight properly
- **Tests** finishing quote go show completion message with timing
**Common debugging tips:**
- **Check** browser console (F12) for JavaScript errors
- **Verify** all file names match exactly (case-sensitive)
- **Ensure** Live Server dey run and dey refresh well
- **Test** plenty quotes to check say random selection dey work
---
## GitHub Copilot Agent Challenge 🎮
Use Agent mode take complete dis challenge:
**Description:** Expand typing game by adding difficulty system wey adjust game based on player performance. This challenge go help you practice advanced event handling, data analysis, and dynamic UI updates.
**Prompt:** Create difficulty adjustment system for typing game wey:
1. Track player typing speed (words per minute) and accuracy percentage
2. Automatically adjust to three difficulty levels: Easy (simple quotes), Medium (current quotes), Hard (complex quotes with punctuation)
3. Show current difficulty level and player stats on UI
4. Implement streak counter wey increase difficulty after 3 good performances in row
5. Add visual feedback (colors, animations) to show difficulty changes
Add necessary HTML elements, CSS styles, and JavaScript functions to implement dis feature. Make sure error handling dey proper and game remain accessible wit correct ARIA labels.
Learn more about [agent mode](https://code.visualstudio.com/blogs/2025/02/24/introducing-copilot-agent-mode) here.
## 🚀 Challenge
Ready to take your typing game go next level? Try put these advanced features add to grow understanding of event handling and DOM manipulation:
**Add more functionality:**
| Feature | Description | Skills You'll Practice |
|---------|-------------|------------------------|
| **Input Control** | Disable `input` event listener after completion, re-enable when button clicked | Event management and state control |
| **UI State Management** | Disable textbox when player finish quote | DOM property manipulation |
| **Modal Dialog** | Show modal dialog box with success message | Advanced UI patterns and accessibility |
| **High Score System** | Store high scores using `localStorage` | Browser storage APIs and data persistence |
**Implementation tips:**
- **Research** `localStorage.setItem()` and `localStorage.getItem()` for persistent storage
- **Practice** adding and removing event listeners dynamically
- **Explore** HTML dialog elements or CSS modal patterns
- **Consider** accessibility while disabling and enabling form controls
## Post-Lecture Quiz
[Post-lecture quiz](https://ff-quizzes.netlify.app/web/quiz/22)
---
## 🚀 Your Typing Game Mastery Timeline
### ⚡ **Wetin You Fit Do for Next 5 Minutes**
- [ ] Test your typing game wit different quotes to make sure e smooth
- [ ] Try change CSS styling - try change highlight and error colors
- [ ] Open browser DevTools (F12) and watch console while you dey play
- [ ] Challenge yourself make you finish quote fast
### ⏰ **Wetin You Fit Accomplish This Hour**
- [ ] Add more quotes to array (maybe from your favorite books or movies)
- [ ] Implement localStorage high score system from challenge section
- [ ] Create words-per-minute calculator wey show after each game
- [ ] Add sound effects for correct typing, errors, and completion
### 📅 **Your Week-Long Adventure**
- [ ] Build multiplayer version weh friends fit compete side-by-side
- [ ] Create different difficulty levels with varying quote complexity
- [ ] Add progress bar show how much of quote don complete
- [ ] Implement user accounts with personal stats tracking
- [ ] Design custom themes and allow users choose their preferred styling
### 🗓️ **Your Month-Long Transformation**
- [ ] Create typing course with lessons wey dey teach proper finger placement step-by-step
- [ ] Build analytics show which letters or words dey cause plenty errors
- [ ] Add support for different languages and keyboard layouts
- [ ] Integrate educational APIs to pull quotes from literature databases
- [ ] Publish your enhanced typing game make others fit use and enjoy
### 🎯 **Final Reflection Check-in**
**Before you move on, take time celebrate:**
- Wetin be the most satisfying moment as you dey build this game?
- How do you feel about event-driven programming now compared to when you start?
- Which one feature you dey excited to add to make dis game uniquely yours?
- How you fit apply event handling concepts to other projects?
```mermaid
journey
title Your Event Programming Confidence Journey
section Today
Understanding Events: 3: You
Building UI: 4: You
Writing Event Listeners: 5: You
section This Week
Adding Features: 4: You
Debugging Issues: 5: You
Enhancing UX: 4: You
section Next Month
Building Complex Apps: 5: You
Teaching Others: 5: You
Creating Frameworks: 5: You
```
> 🌟 **Remember**: You don master one core concept wey dey power every interactive website and app. Event-driven programming na wetin dey make web feel alive and responsive. Anytime you see dropdown menu, form wey dey validate as you type, or game wey respond to your clicks, you don sabi the magic behind am. You no just dey learn code - you dey learn to create experiences wey go feel natural and engaging! 🎉
---
## Review & Self Study
Read up on [all the events available](https://developer.mozilla.org/docs/Web/Events) give the developer through web browser, and reason the scenarios where you go use each one.
## Assignment
[Create a new keyboard game](assignment.md)
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document na e get translate wit AI translation service wey dem dey call [Co-op Translator](https://github.com/Azure/co-op-translator). Even though we dey try make everything correct, abeg remember say automated translate fit get some errors or mistakes. Di original document wey dem write for im own language na di correct one wey you suppose trust. If na serious matter, e good make person wey sabi translate for human do am. We no go responsible if pesin go misunderstand or misinterpret anything wey dis translation carry.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,57 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "3eac59d70e2532a677a2ce6bf765485a",
"translation_date": "2026-01-08T18:22:36+00:00",
"source_file": "4-typing-game/typing-game/assignment.md",
"language_code": "pcm"
}
-->
# Create new keyboard game
## Instructions
Now wey you don sabi di fundamentals of event-driven programming wit di typing game, na time to show your creativity! You go design and build your own keyboard-based game weh go show say you understand how event handling, DOM manipulation, and user interaction patterns dey work.
Make you create small game weh dey use keyboard events to do specific tasks. E fit be different kind typing game, art app weh dey paint pixels for screen anytime keyboard key press, simple arcade-style game weh you control wit arrow keys, or any other creative idea weh you fit think. Make you use your brain, reason how different keys fit trigger different kain behavior!
**Your game suppose get:**
| Requirement | Description | Purpose |
|-------------|-------------|---------|
| **Event Listeners** | Respond to at least 3 different keyboard events | Show say you sabi event handling |
| **Visual Feedback** | Give immediate visual response to wetin user input | Show say you sabi DOM manipulation |
| **Game Logic** | Get scoring, levels, or progression mechanics | Practice how to implement application state |
| **User Interface** | Clear instructions and easy to use controls | Develop user experience design skills |
**Creative project ideas to consider:**
- **Rhythm Game**: Players press keys to di rhythm of music or visual cues
- **Pixel Art Creator**: Different keys dey paint different colors or patterns
- **Word Builder**: Players dey create words by typing letters for specific order
- **Snake Game**: You fit control snake wit arrow keys to collect items
- **Music Synthesizer**: Different keys dey play different kind musical tones or sounds
- **Speed Typing Variants**: Category-specific typing (programming words, foreign languages)
- **Keyboard Drummer**: Create beats by mapping keys to different drum sounds
**Implementation guidelines:**
- **Start** with simple idea then build complexity gradually
- **Focus** on smooth, responsive controls wey go feel natural
- **Include** clear visual signs for game state and player progress
- **Test** your game wit different people to make sure e easy to play
- **Document** your code wit comments weh explain your event handling plan
## Rubric
| Criteria | Exemplary | Adequate | Needs Improvement |
| -------- | --------- | -------- | ----------------- |
| **Functionality** | Complete, polished game wey get many features and smooth gameplay | Working game with basic features wey show keyboard event handling | Minimal implementation with limited function or serious bugs |
| **Code Quality** | Well-organized, commented code wey follow best practices wit efficient event handling | Clean, readable code with correct use of event listeners and DOM manipulation | Basic code structure with some organization wahala or inefficient implementation |
| **User Experience** | Controls dey easy, feedback clear, gameplay interesting and professional | Functional interface with enough user guidance and responsive controls | Basic interface wey instructions no clear or e no dey responsive well |
| **Creativity** | Original idea wit innovative use of keyboard events and creative problem solving | Interesting variation of common game patterns with good use of event handling | Simple implementation of basic idea wit small creative elements |
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document na AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator) wey translate am. Even though we try make e correct, pls sabi say automated translations fit get some mistakes or wrong tori. Di original document wey dey dia for inside im original language na di correct source. If na serious tori, make person wey sabi human translation do am. We no go take any blame if person no understand or miss meaning because of dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,554 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "00aa85715e1efd4930c17a23e3012e69",
"translation_date": "2026-01-08T15:39:46+00:00",
"source_file": "5-browser-extension/1-about-browsers/README.md",
"language_code": "pcm"
}
-->
# Browser Extension Project Part 1: All about Browsers
```mermaid
journey
title Your Browser Extension Development Journey
section Foundation
Understand browsers: 3: Student
Learn extension types: 4: Student
Setup development: 4: Student
section Development
Build interface: 4: Student
Add functionality: 5: Student
Handle data: 5: Student
section Integration
Test in browser: 5: Student
Debug issues: 4: Student
Polish experience: 5: Student
```
![Browser sketchnote](../../../../translated_images/browser.60317c9be8b7f84a.pcm.jpg)
> Sketchnote by [Wassim Chegham](https://dev.to/wassimchegham/ever-wondered-what-happens-when-you-type-in-a-url-in-an-address-bar-in-a-browser-3dob)
## Pre-Lecture Quiz
[Pre-lecture quiz](https://ff-quizzes.netlify.app/web/quiz/23)
### Introduction
Browser extensions na small apps wey dey make your web browsing beta. Like Tim Berners-Lee original plan for interactive web, extensions dey increase the browser power pass just to dey look documents. From password managers wey dey keep your account safe to color pickers wey help designers find correct shades, extensions dey solve wahala wey dey everyday browsing.
Before we build your first extension, make we understand how browsers dey work. Just like Alexander Graham Bell suppose understand how sound dey carry before e invent telephone, to sabi browser basics go help you make extensions wey go join well-well with browser systems.
By the end of this lesson, you go sabi browser architecture and start to build your first extension.
```mermaid
mindmap
root((Browser Architecture))
Core Components
Rendering Engine
JavaScript Engine
Network Stack
Storage APIs
User Interface
Address Bar
Tab Management
Bookmarks
Extension Icons
Extension System
Manifest Files
Content Scripts
Background Pages
Popup Windows
Security Model
Same-Origin Policy
Permissions API
Content Security
Isolated Worlds
Development Tools
DevTools Integration
Debug Console
Performance Monitor
Extension Inspector
```
## Understanding Web Browsers
Web browser na correct document interpreter. When you type "google.com" inside address bar, browser go do gbege series of work - e go request content from servers for everywhere, then e go parse am and render dat code into interactive web pages wey you dey see.
This process dey like how first web browser, WorldWideWeb, Tim Berners-Lee design am for 1990 so that everybody fit access hyperlinked documents.
**Small history**: Di first browser na 'WorldWideWeb' an e be Tim Berners-Lee create am for 1990.
![early browsers](../../../../translated_images/earlybrowsers.d984b711cdf3a42d.pcm.jpg)
> Some early browsers, via [Karen McGrane](https://www.slideshare.net/KMcGrane/week-4-ixd-history-personal-computing)
### How Browsers Process Web Content
The process between to put URL and see webpage get many steps wey dem arranged nicely, and everything happen in seconds:
```mermaid
sequenceDiagram
participant User
participant Browser
participant Extension
participant DNS
participant Server
User->>Browser: Types URL and presses Enter
Browser->>Extension: Trigger beforeRequest event
Extension->>Extension: Check if URL needs modification
Browser->>DNS: Looks up server IP address
DNS->>Browser: Returns IP address
Browser->>Server: Requests web page content
Server->>Browser: Sends HTML, CSS, and JavaScript
Browser->>Extension: Trigger beforeResponse event
Extension->>Extension: Modify content if needed
Browser->>User: Render di complete web page
Extension->>User: Show extension UI updates
```
**Dis na wetin dis process dey do:**
- **Translate** human readable URL go server IP address through DNS lookup
- **Set up** secure connection with the web server using HTTP or HTTPS protocols
- **Request** the exact web page content from the server
- **Receive** HTML markup, CSS styling, and JavaScript code from server
- **Render** all di content to interactive web page wey you dey see
### Browser Core Features
Modern browsers get plenty features wey extension developers fit use:
| Feature | Purpose | Extension Opportunities |
|---------|---------|------------------------|
| **Rendering Engine** | Display HTML, CSS, JavaScript | Change content, styling injection |
| **JavaScript Engine** | Run JavaScript code | Custom scripts, API interactions |
| **Local Storage** | Save data local | User preferences, cached data |
| **Network Stack** | Handle web requests | Monitor requests, data analysis |
| **Security Model** | Protect users from bad content | Content filtering, security upgrades |
**To sabi these features go help you:**
- **Know** where your extension fit add the most value
- **Pick** correct browser APIs for your extension work
- **Design** extensions wey dey work well with browser system
- **Make sure** your extension follow browser security best practices
### Cross-Browser Development Considerations
Different browsers dey do standards small-small different, like how different programming languages dey handle algorithm differently too. Chrome, Firefox, and Safari get their own way wey developers must understand as dem develop extensions.
> 💡 **Pro Tip**: Use [caniuse.com](https://www.caniuse.com) to check which web technologies browsers support. Dis thing go help you plan your extension well!
**Important things to remember when developing extensions:**
- **Test** your extension for Chrome, Firefox, and Edge
- **Adjust** to different browser extension APIs and manifest formats
- **Handle** different performance and limits
- **Provide** fallbacks for browser-specific features wey no too dey available
**Analytics Insight**: You fit sabi the browsers wey your users like by installing analytics tools for your web projects. Dis data go help you know which browser to support first.
## Understanding Browser Extensions
Browser extensions dey solve common web browsing problems by adding extra work directly to the browser interface. No need for separate apps or complicated workflow, extensions go give quick access to tools.
Dis idea na like how early computer pioneers like Douglas Engelbart think say technology fit boost wetin humans fit do - extensions go add power to your browser.
```mermaid
quadrantChart
title Browser Extension Categories
x-axis Simple --> Complex
y-axis Personal Use --> Professional Tools
quadrant-1 Developer Tools
quadrant-2 Enterprise Solutions
quadrant-3 Personal Utilities
quadrant-4 Productivity Apps
Ad Blockers: [0.3, 0.2]
Password Managers: [0.7, 0.3]
Color Pickers: [0.4, 0.8]
Code Formatters: [0.8, 0.9]
Note Taking: [0.6, 0.5]
Video Downloaders: [0.5, 0.2]
Time Trackers: [0.7, 0.6]
Screenshot Tools: [0.4, 0.4]
```
**Popular extension categories and benefits:**
- **Productivity Tools**: Task managers, note-taking apps, time trackers wey dey help you organize
- **Security Enhancements**: Password managers, ad blockers, privacy tools wey protect your data
- **Developer Tools**: Code formatters, color pickers, debugging tools wey make development easier
- **Content Enhancement**: Reading modes, video downloaders, screenshot tools wey improve your web experience
**Reflection Question**: Wetin be your favorite browser extensions? Wetin dem dey do, and how e dey make your browsing better?
### 🔄 **Pedagogical Check-in**
**Browser Architecture Understanding**: Before you start to develop extensions, make sure you:
- ✅ Fit explain how browsers dey process web requests and display content
- ✅ Fit identify main parts for browser architecture
- ✅ Understand how extensions join with browser functions
- ✅ Know security model wey protect users
**Quick Self-Test**: You fit trace the way from when you type URL to when webpage show?
1. **DNS lookup** convert URL go IP address
2. **HTTP request** fetch content from server
3. **Parsing** processes HTML, CSS, JavaScript
4. **Rendering** display final webpage
5. **Extension** fit change content for different steps
## Installing and Managing Extensions
To sabi extension installation process go help you sabi how user experience go be when people dey install your extension. Installation process dey similar for all modern browsers, only small design differences.
![screenshot of the Edge browser showing the open edge://extensions page and open settings menu](../../../../translated_images/install-on-edge.d68781acaf0b3d3d.pcm.png)
> **Important**: Make sure say developer mode dey on and you allow extensions wey come from other stores when you dey test your own extensions.
### Development Extension Installation Process
When you dey develop and test your own extensions, follow this steps:
```mermaid
flowchart TD
A[Write Code] --> B[Build Extension]
B --> C{First Install?}
C -->|Yes| D[Load Unpacked]
C -->|No| E[Reload Extension]
D --> F[Test Functionality]
E --> F
F --> G{Working Correctly?}
G -->|No| H[Debug Issues]
G -->|Yes| I[Ready for Users]
H --> A
I --> J[Publish to Store]
style A fill:#e1f5fe
style F fill:#e8f5e8
style I fill:#f3e5f5
style J fill:#fff3e0
```
```bash
# Step 1: Make your extension
npm run build
```
**Wetìn dis command dey do:**
- **Compile** your source code into browser ready files
- **Bundle** JavaScript modules into better optimized packages
- **Create** final extension files for `/dist` folder
- **Prepare** your extension for installation and testing
**Step 2: Go Browser Extensions**
1. **Open** your browser extension management page
2. **Click** "Settings and more" button (`...` icon) for top right
3. **Select** "Extensions" from menu
**Step 3: Load Your Extension**
- **For new installs**: Choose `load unpacked` and select your `/dist` folder
- **For updates**: Click `reload` beside your installed extension
- **For testing**: Turn on "Developer mode" to get extra debugging features
### Production Extension Installation
> ✅ **Note**: These development instructions na for extensions wey you dey build yourself. If you want install published extensions, go official browser extension stores like [Microsoft Edge Add-ons store](https://microsoftedge.microsoft.com/addons/Microsoft-Edge-Extensions-Home).
**Understand the difference:**
- **Development install** let you test unpublished extensions as you develop
- **Store install** na vetted, published extensions wey get automatic updates
- **Sideloading** na to install extensions from outside official stores (developer mode must dey on)
## Building Your Carbon Footprint Extension
We go create browser extension wey go show carbon footprint for your region energy use. Dis project show key extension development concepts plus create real tool for environment.
Dis approach follow "learning by doing" principle wey John Dewey education theory dey support - mix technical skills with real-world purpose.
### Project Requirements
Before you start development, make we gather wetin we need:
**Required API Access:**
- **[CO2 Signal API key](https://www.co2signal.com/)**: Put your email to get free API key
- **[Region code](http://api.electricitymap.org/v3/zones)**: Find your region code on [Electricity Map](https://www.electricitymap.org/map) (for example, Boston get 'US-NEISO')
**Development Tools:**
- **[Node.js and NPM](https://www.npmjs.com)**: Package manager tool to install project dependencies
- **[Starter code](../../../../5-browser-extension/start)**: Download `start` folder to start development
**Learn More**: Improve your package management skills with this [comprehensive Learn module](https://docs.microsoft.com/learn/modules/create-nodejs-project-dependencies/?WT.mc_id=academic-77807-sagibbon)
### Understanding the Project Structure
Sabi project structure help organize development work better. Like Library of Alexandria organize knowledge for easy retrieval, well-structured codebase make development faster:
```
project-root/
├── dist/ # Built extension files
│ ├── manifest.json # Extension configuration
│ ├── index.html # User interface markup
│ ├── background.js # Background script functionality
│ └── main.js # Compiled JavaScript bundle
├── src/ # Source development files
│ └── index.js # Your main JavaScript code
├── package.json # Project dependencies and scripts
└── webpack.config.js # Build configuration
```
**Break down wetin each file do:**
- **`manifest.json`**: **Define** extension metadata, permissions, and entry points
- **`index.html`**: **Create** user interface wey show when people click your extension
- **`background.js`**: **Handle** background work and browser event listeners
- **`main.js`**: **Contain** final bundled JavaScript after build
- **`src/index.js`**: **House** your main development code wey go compile into `main.js`
> 💡 **Organization Tip**: Keep your API key and region code for secure note so you fit easily check am during development. You go need am to test extension work.
**Security Note**: No ever commit API keys or sensitive info to code repository. We go show you how to keep am safe later.
## Creating the Extension Interface
Now, we go build user interface parts. The extension get two screens: one for setup and one for result show.
This follow progressive disclosure principle inside interface design since early computers - dey show info and options step by step so no overwhelm user.
### Extension Views Overview
**Setup View** - Configuration for first time user:
![screenshot of the completed extension open in a browser, displaying a form with inputs for region name and API key.](../../../../translated_images/1.b6da8c1394b07491.pcm.png)
**Results View** - Carbon footprint data display:
![screenshot of the completed extension displaying values for carbon usage and fossil fuel percentage for the US-NEISO region.](../../../../translated_images/2.1dae52ff08042246.pcm.png)
### Building the Configuration Form
Setup form go collect user config data on first use. After you set am, info go remain for browser storage for next times.
For `/dist/index.html` file, add dis form structure:
```html
<form class="form-data" autocomplete="on">
<div>
<h2>New? Add your Information</h2>
</div>
<div>
<label for="region">Region Name</label>
<input type="text" id="region" required class="region-name" />
</div>
<div>
<label for="api">Your API Key from tmrow</label>
<input type="text" id="api" required class="api-key" />
</div>
<button class="search-btn">Submit</button>
</form>
```
**Wetìn dis form dey do:**
- **Create** semantic form with correct labels and input connection
- **Enable** browser autocomplete to make user experience better
- **Require** both fields to fill before submit using `required` attribute
- **Organize** inputs with class names to ease styling and JavaScript access
- **Give** clear instructions to users wey dey set extension first time
### Building the Results Display
Next, create where results go show the carbon footprint data. Add dis HTML below the form:
```html
<div class="result">
<div class="loading">loading...</div>
<div class="errors"></div>
<div class="data"></div>
<div class="result-container">
<p><strong>Region: </strong><span class="my-region"></span></p>
<p><strong>Carbon Usage: </strong><span class="carbon-usage"></span></p>
<p><strong>Fossil Fuel Percentage: </strong><span class="fossil-fuel"></span></p>
</div>
<button class="clear-btn">Change region</button>
</div>
```
**Break down wetin dis place dey provide:**
- **`loading`**: **Show** loading message while API data dey fetch
- **`errors`**: **Show** error messages if API call fail or data no correct
- **`data`**: **Hold** raw data for debugging during development
- **`result-container`**: **Display** formatted carbon footprint info to users
- **`clear-btn`**: **Allow** users change region and reset extension
### Setting Up the Build Process
Now make we install project dependencies and test build process:
```bash
npm install
```
**Wetín dis installation go do:**
- **Download** Webpack and other development dependencies from `package.json`
- **Configure** build tools for compiling modern JavaScript
- **Prepare** development environment to build and test extension
- **Enable** code bundling, optimization, and cross-browser support
> 💡 **Build Process Insight**: Webpack bundle your source code from `/src/index.js` into `/dist/main.js`. Dis process go optimize your code for production and make am compatible with browsers.
### Testing Your Progress
For now, you fit start to test your extension:
1. **Run** di build command to compile ya kode
2. **Load** di extension inside ya browser wit di developer mode
3. **Verify** sey di form dey show well and e fine well well
4. **Check** sey all di form elements line well and dey work
**Wetin you don achieve:**
- **Built** di basic HTML structure for ya extension
- **Created** both configuration and results interfaces with correct semantic markup
- **Set up** modern development workflow using industry-standard tools
- **Prepared** di foundation to add interactive JavaScript functionality
### 🔄 **Pedagogical Check-in**
**Extension Development Progress**: Make sure sey you sabi before you continue:
- ✅ You fit explain di purpose of each file inside di project structure?
- ✅ You understand how di build process dey turn your source code?
- ✅ Why we separate configuration and results into different UI sections?
- ✅ How di form structure dey support both usability and accessibility?
**Development Workflow Understanding**: You suppose fit now to:
1. **Modify** HTML and CSS for ya extension interface
2. **Run** di build command to compile your changes
3. **Reload** di extension inside your browser to test updates
4. **Debug** wahala using browser developer tools
You don finish di first phase of browser extension development. Just like how Wright brothers first gats understand aerodynamics before dem fit fly, understanding dis basic kind concept dey prepare you to build more complex interactive features for the next lesson.
## GitHub Copilot Agent Challenge 🚀
Use di Agent mode to finish di following challenge:
**Description:** Make di browser extension beta by adding form validation and user feedback features to better di user experience when dem dey put API keys and region codes.
**Prompt:** Create JavaScript validation functions wey go check if di API key field get at least 20 characters and if di region code follow the correct format (like 'US-NEISO'). Add visual feedback by changing input border colors to green if valid and red if no correct. Make you also add toggle feature to show/hide di API key for security reasons.
Find out more about [agent mode](https://code.visualstudio.com/blogs/2025/02/24/introducing-copilot-agent-mode) here.
## 🚀 Challenge
Make you check one browser extension store and install one for your browser. You fit check im files in interesting way. Wetin you discover?
## Post-Lecture Quiz
[Post-lecture quiz](https://ff-quizzes.netlify.app/web/quiz/24)
## Review & Self Study
For dis lesson you learn small about di history of web browser; take dis chance to learn how di inventors of di World Wide Web see how people go use am by reading more about di history. Some sites wey fit help include:
[The History of Web Browsers](https://www.mozilla.org/firefox/browsers/browser-history/)
[History of the Web](https://webfoundation.org/about/vision/history-of-the-web/)
[An interview with Tim Berners-Lee](https://www.theguardian.com/technology/2019/mar/12/tim-berners-lee-on-30-years-of-the-web-if-we-dream-a-little-we-can-get-the-web-we-want)
### ⚡ **Wetin You Fit Do for Next 5 Minutes**
- [ ] Open Chrome/Edge extensions page (chrome://extensions) and explore wetin you get for your browser
- [ ] Look your browser DevTools Network tab as you dey load webpage
- [ ] Try see page source (Ctrl+U) to check HTML structure
- [ ] Inspect any webpage element and change im CSS inside DevTools
### 🎯 **Wetin You Fit Achieve Dis Hour**
- [ ] Finish di post-lesson quiz and sabi browser fundamentals
- [ ] Create basic manifest.json file for browser extension
- [ ] Build simple "Hello World" extension wey go show popup
- [ ] Test loading your extension for developer mode
- [ ] Explore di browser extension documentation for your target browser
### 📅 **Your Week-Long Extension Journey**
- [ ] Finish functional browser extension wey get real use
- [ ] Learn about content scripts, background scripts, and popup interactions
- [ ] Master browser APIs like storage, tabs, and messaging
- [ ] Design user-friendly interfaces for your extension
- [ ] Test your extension on different websites and scenarios
- [ ] Publish your extension to the browser extension store
### 🌟 **Your Month-Long Browser Development**
- [ ] Build many extensions wey solve different user problems
- [ ] Learn advanced browser APIs and correct security ways
- [ ] Contribute to open source browser extension projects
- [ ] Master cross-browser compatibility and progressive enhancement
- [ ] Create extension development tools and templates for other people to use
- [ ] Become browser extension expert wey fit help other developers
## 🎯 Your Browser Extension Mastery Timeline
```mermaid
timeline
title Browser Extension Development Progression
section Foundation (15 minutes)
Browser Understanding: Core architecture
: Rendering process
: Extension integration points
section Setup (20 minutes)
Development Environment: Project structure
: Build tools configuration
: Browser developer mode
: Extension loading process
section Interface Design (25 minutes)
User Experience: HTML structure
: CSS styling
: Form validation
: Responsive design
section Core Functionality (35 minutes)
JavaScript Integration: Event handling
: API interactions
: Data storage
: Error handling
section Browser APIs (45 minutes)
Platform Integration: Permissions system
: Storage APIs
: Tab management
: Context menus
section Advanced Features (1 week)
Professional Extensions: Background scripts
: Content scripts
: Cross-browser compatibility
: Performance optimization
section Publishing (2 weeks)
Distribution: Store submission
: Review process
: User feedback
: Update management
section Expert Level (1 month)
Extension Ecosystem: Advanced APIs
: Security best practices
: Enterprise features
: Framework integration
```
### 🛠️ Your Extension Development Toolkit Summary
After you finish dis lesson, you now get:
- **Browser Architecture Knowledge**: You sabi rendering engines, security models, and extension integration
- **Development Environment**: Modern tools like Webpack, NPM, and debugging
- **UI/UX Foundation**: Semantic HTML structure with progressive disclosure patterns
- **Security Awareness**: You know browser permissions and how to develop safely
- **Cross-Browser Concepts**: You sabi compatibility and testing approach
- **API Integration**: Foundation to work with external data
- **Professional Workflow**: Industry-standard development and testing methods
**Real-World Applications**: These skills good for:
- **Web Development**: Single-page applications and progressive web apps
- **Desktop Applications**: Electron and web-based desktop software
- **Mobile Development**: Hybrid apps and web-based mobile solutions
- **Enterprise Tools**: Internal productivity apps and workflow automation
- **Open Source**: Contributing to browser extension projects and web standards
**Next Level**: You ready to add interactive features, work with browser APIs, and create extensions wey go solve real user wahala!
## Assignment
[Restyle your extension](assignment.md)
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**: Dis document don translate wit AI translation service wey dem call [Co-op Translator](https://github.com/Azure/co-op-translator). Even though we dey try make everything correct, abeg make you sabi say automatic translation fit get wahala or mistake. Di original document for im own language na im get di real correct tin. If na important information, better make professional human translation do am. We no go responsible for any yawa or wrong understanding wey fit happen because of dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,146 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "b6897c02603d0045dd6d8256e8714baa",
"translation_date": "2026-01-08T15:51:21+00:00",
"source_file": "5-browser-extension/1-about-browsers/assignment.md",
"language_code": "pcm"
}
-->
# Assignment: Restyle Your Browser Extension
## Overview
Now wey you don build di HTML structure for your carbon footprint browser extension, na time to make am fine to look and easy to use. Beta design dey improve user experience and e go make your extension dey more professional and interesting.
Your extension get basic CSS styling, but dis assignment go challenge you to create your own visual style wey go show your personal taste plus make sure e still easy to use.
## Instructions
### Part 1: Analyze the Current Design
Before you start to change am, look di CSS structure wey dey already:
1. **Locate** di CSS files inside your extension project
2. **Review** di current styling way and color scheme
3. **Identify** places wey fit improve for layout, typography, and visual hierarchy
4. **Consider** how design dey support wetin user want (easy form fill and clear data show)
### Part 2: Design Your Custom Styling
Create one solid visual design wey go include:
**Color Scheme:**
- Choose main color pallet wey go show environmental themes
- Make sure di contrast reach well for accessibility (use tools like WebAIM's contrast checker)
- Think about how colors go look for different browser themes
**Typography:**
- Pick fonts wey easy to read wey go still fine for small extension size
- Set clear hierarchy with correct font sizes and weights
- Make sure text still dey clear for both light and dark browser themes
**Layout and Spacing:**
- Improve how form elements and data display arrange for better look
- Add correct padding and margins to make e easier to read
- Think about responsive design principles wey fit different screen sizes
### Part 3: Implement Your Design
Change di CSS files to put your design for ground:
```css
/* Example starting points for customization */
.form-data {
/* Style the configuration form */
background: /* your choice */;
padding: /* your spacing */;
border-radius: /* your preference */;
}
.result-container {
/* Style the data display area */
background: /* complementary color */;
border: /* your border style */;
margin: /* your spacing */;
}
/* Add your custom styles here */
```
**Key areas to style:**
- **Form elements**: Input fields, labels, and submit button
- **Results display**: Data container, text styling, and loading states
- **Interactive elements**: Hover effects, button states, and transitions
- **Overall layout**: Container spacing, background colors, and visual hierarchy
### Part 4: Test and Refine
1. **Build** your extension with `npm run build`
2. **Load** di updated extension for your browser
3. **Test** all visual states (form entry, loading, results display, errors)
4. **Verify** accessibility using browser developer tools
5. **Refine** your styles based on how e really perform
## Creative Challenges
### Basic Level
- Change colors and fonts to create one solid theme
- Improve spacing and alignment for the whole interface
- Add soft hover effects to interactive parts
### Intermediate Level
- Design custom icons or graphics for your extension
- Make smooth transitions between different states
- Create a unique loading animation for API calls
### Advanced Level
- Design different themes (light/dark/high-contrast)
- Make responsive design wey fit different browser window sizes
- Add micro-interactions wey go improve user experience
## Submission Guidelines
Your finished assignment suppose include:
- **Modified CSS files** wey get your custom styling
- **Screenshots** wey show your extension for different states (form, loading, results)
- **Short description** (2-3 sentences) to explain your design choices and how dem make user experience better
## Assessment Rubric
| Criteria | Exemplary (4) | Proficient (3) | Developing (2) | Beginning (1) |
|----------|---------------|----------------|----------------|----------------|
| **Visual Design** | Creative, cohesive design wey go enhance usability and show strong design principles | Good design choices with consistent styling and clear visual hierarchy | Basic design improvements but get some consistency wahala | Small styling changes or inconsistent design |
| **Functionality** | All styles dey work perfectly for different states and browser environments | Styles work well but get small issues for edge cases | Most styles dey work but get some display wahala | Big styling problems wey dey affect usability |
| **Code Quality** | Clean, well-organized CSS with proper class names and efficient selectors | Good CSS structure with correct use of selectors and properties | Acceptable CSS but get some organization issues | Poor CSS structure or styling way too complex |
| **Accessibility** | Excellent color contrast, readable fonts, and consideration for users with disabilities | Good accessibility practices but get small areas wey fit improve | Basic accessibility consideration but get some problems | Limited care for accessibility needs |
## Tips for Success
> 💡 **Design Tip**: Start with small changes and build to bigger styling. Small improvements for typography and spacing fit get big impact for how people feel about am.
**Best practices to follow:**
- **Test** your extension for both light and dark browser themes
- **Use** relative units (em, rem) to make am scalable
- **Maintain** consistent spacing with CSS custom properties
- **Consider** how your design go look for users with different visual needs
- **Validate** your CSS to make sure e follow correct syntax
> ⚠️ **Common Mistake**: No sacrifice usability just to make am fine. Your extension suppose be both beautiful and functional.
**Remember to:**
- **Keep** important information easy to read
- **Make sure** buttons and interactive parts easy to click
- **Maintain** clear visual feedback when user dey do action
- **Test** your design with real data, no just placeholder text
Good luck for creating browser extension wey dey functional and fine to look!
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document don translate wit AI translation service wey dem dey call [Co-op Translator](https://github.com/Azure/co-op-translator). Even though we dey try make am correct, abeg make you sabi say automated translations fit get some mistakes or wrong tins. The original document wey dey the correct language na the correct source. If na important tin, better make person wey sabi translate am do am. We no go take any blame if person no understand well or if mistake happen because of dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,664 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "2b6203a48c48d8234e0948353b47d84e",
"translation_date": "2026-01-08T15:03:33+00:00",
"source_file": "5-browser-extension/2-forms-browsers-local-storage/README.md",
"language_code": "pcm"
}
-->
# Browser Extension Project Part 2: Call an API, use Local Storage
```mermaid
journey
title Your API Integration & Storage Journey
section Foundation
Setup DOM references: 3: Student
Add event listeners: 4: Student
Handle form submission: 4: Student
section Data Management
Implement local storage: 4: Student
Build API calls: 5: Student
Handle async operations: 5: Student
section User Experience
Add error handling: 5: Student
Create loading states: 4: Student
Polish interactions: 5: Student
```
## Pre-Lecture Quiz
[Pre-lecture quiz](https://ff-quizzes.netlify.app/web/quiz/25)
## Introduction
Remember dat browser extension wey you start build? Right now you get one beta form wey fine, but e just dey static. Today we go make am come alive by connect am to real data and give am memory.
Think about di Apollo mission control computers - dem no just dey show fixed information. Dem dey always relate wit spacecrafts, dey update wit telemetry data, and dem dey remember important mission parameters. Na dis kain dynamic behavior we dey build today. Your extension go reach out to internet, gather real environmental data, and remember your settings for next time.
API integration fit sound hard, but na just teaching your code how e go yan wit other services be dat. Whether you dey fetch weather data, social media feeds, or carbon footprint info like we go do today, na all about to make dis digital connections. We go also explore how browsers fit keep information - like how libraries take use card catalogs to remember where book dem dey.
By di end of dis lesson, you go get browser extension wey dey fetch real data, dey store user preferences, and dey provide smooth experience. Make we begin!
```mermaid
mindmap
root((Dynamic Extensions))
DOM Manipulation
Element Selection
Event Handling
State Management
UI Updates
Local Storage
Data Persistence
Key-Value Pairs
Session Management
User Preferences
API Integration
HTTP Requests
Authentication
Data Parsing
Error Handling
Async Programming
Promises
Async/Await
Error Catching
Non-blocking Code
User Experience
Loading States
Error Messages
Smooth Transitions
Data Validation
```
✅ Follow di numbered segments for di correct files to sabi where to put your code
## Set up the elements to manipulate for di extension
Before your JavaScript fit manipulate di interface, e need references to specific HTML elements. Think am like telescope wey e need point for certain stars - before Galileo fit study Jupiter moons, e gats locate and focus for Jupiter itself.
For your `index.js` file, we go create `const` variables wey go capture references to every important form element. Dis one be like how scientists dey label their equipment - instead to dey find everywhere for di laboratory every time, dem fit just access wetin dem need straight.
```mermaid
flowchart LR
A[JavaScript Code] --> B[document.querySelector]
B --> C[CSS Selectors]
C --> D[HTML Elements]
D --> E[".form-data"]
D --> F[".region-name"]
D --> G[".api-key"]
D --> H[".loading"]
D --> I[".errors"]
D --> J[".result-container"]
E --> K[Form Element]
F --> L[Input Field]
G --> M[Input Field]
H --> N[UI Element]
I --> O[UI Element]
J --> P[UI Element]
style A fill:#e1f5fe
style D fill:#e8f5e8
style K fill:#fff3e0
style L fill:#fff3e0
style M fill:#fff3e0
```
```javascript
// form filds
const form = document.querySelector('.form-data');
const region = document.querySelector('.region-name');
const apiKey = document.querySelector('.api-key');
// resalts
const errors = document.querySelector('.errors');
const loading = document.querySelector('.loading');
const results = document.querySelector('.result-container');
const usage = document.querySelector('.carbon-usage');
const fossilfuel = document.querySelector('.fossil-fuel');
const myregion = document.querySelector('.my-region');
const clearBtn = document.querySelector('.clear-btn');
```
**Na wetin dis code dey do:**
- **Captures** form elements using `document.querySelector()` wit CSS class selectors
- **Creates** references to input fields for di region name and API key
- **Establishes** connections to result display elements for carbon usage data
- **Sets up** access to UI elements like loading indicators and error messages
- **Stores** each element reference inside `const` variable to make am easy to use everywhere for your code
## Add event listeners
Now we go make your extension respond to wetin user dey do. Event listeners na how your code dey monitor user actions. Think dem like telephone operators wey dey early exchanges - dem dey listen for incoming calls then dem go connect di correct circuits when pesin want make connection.
```mermaid
sequenceDiagram
participant User
participant Form
participant JavaScript
participant API
participant Storage
User->>Form: Dey fill region/API key
User->>Form: Click submit
Form->>JavaScript: Trigger submit event
JavaScript->>JavaScript: handleSubmit(e)
JavaScript->>Storage: Save user preferences
JavaScript->>API: Fetch carbon data
API->>JavaScript: Returns data
JavaScript->>Form: Update UI wit results
User->>Form: Click clear button
Form->>JavaScript: Trigger click event
JavaScript->>Storage: Clear saved data
JavaScript->>Form: Reset go initial state
```
```javascript
form.addEventListener('submit', (e) => handleSubmit(e));
clearBtn.addEventListener('click', (e) => reset(e));
init();
```
**Make you sabi dis concepts:**
- **Attaches** submit listener to form wey go trigger when users press Enter or click submit
- **Connects** click listener to clear button to reset form
- **Passes** di event object `(e)` to handler functions for extra control
- **Calls** di `init()` function immediately to arrange initial setup of your extension
✅ Note di shorthand arrow function syntax wey dey used for here. Dis modern JavaScript way dey clean pass old school function expression, but both still dey work well!
### 🔄 **Pedagogical Check-in**
**Event Handling Understanding**: Before you start initialization, make sure say you fit:
- ✅ Explain how `addEventListener` dey connect user actions to JavaScript functions
- ✅ Understand why we dey pass event object `(e)` to handler functions
- ✅ Know difference between `submit` and `click` events
- ✅ Describe when `init()` function go run and why
**Quick Self-Test**: Wetin go happen if you forget `e.preventDefault()` when form submit?
*Answer: The page go reload, all JavaScript state go lost, and user experience go stop*
## Build di initialization and reset functions
Make we write the initialization logic for your extension. Di `init()` function na like ship navigation system wey dey check instruments - e dey find current state and change interface based on dat. E dey check if pesin don use your extension before and e load their previous settings.
Di `reset()` function na to give users fresh start - like how scientists dey reset instruments between experiments to get clean data.
```javascript
function init() {
// Check if user don save API credentials before
const storedApiKey = localStorage.getItem('apiKey');
const storedRegion = localStorage.getItem('regionName');
// Set extension icon to general green (placeholder for next lesson)
// TODO: Make icon update for next lesson
if (storedApiKey === null || storedRegion === null) {
// First-time user: show di setup form
form.style.display = 'block';
results.style.display = 'none';
loading.style.display = 'none';
clearBtn.style.display = 'none';
errors.textContent = '';
} else {
// Returning user: load dia saved data automatically
displayCarbonUsage(storedApiKey, storedRegion);
results.style.display = 'none';
form.style.display = 'none';
clearBtn.style.display = 'block';
}
}
function reset(e) {
e.preventDefault();
// Clear stored region make user fit pick new location
localStorage.removeItem('regionName');
// Restart di initialization process
init();
}
```
**Wetin dey happen here:**
- **Retrieves** stored API key and region from browser local storage
- **Checks** if na first-time user (no stored credentials) or na returning user
- **Shows** setup form for new users and hide other interface elements
- **Loads** saved data automatically for returning users and shows reset option
- **Manages** user interface state based on data wey available
**Key tori about Local Storage:**
- **Persists** data between browser sessions (no be like session storage)
- **Stores** data as key-value pairs using `getItem()` and `setItem()`
- **Returns** `null` if no data dey for di key
- **Provides** simple way to remember user preferences and settings
> 💡 **Understanding Browser Storage**: [LocalStorage](https://developer.mozilla.org/docs/Web/API/Window/localStorage) na like to give your extension persistent memory. Think how ancient Library of Alexandria dey store scrolls - information still dey available even if scholars comot then come back.
>
> **Main tori be:**
> - **Persists** data even after you close your browser
> - **Survives** computer restart and browser crash
> - **Provides** big storage space for user preferences
> - **Offers** quick access without network wahala
> **Important Note**: Your browser extension get im own isolated local storage wey separate from normal web pages. Dis one dey keep am secure and prevent conflict wit other websites.
You fit see your stored data by opening browser Developer Tools (F12), go **Application** tab, then expand **Local Storage** section.
```mermaid
stateDiagram-v2
[*] --> CheckStorage: Extension start
CheckStorage --> FirstTime: No data wey dem store
CheckStorage --> Returning: Data dey
FirstTime --> ShowForm: Show setup form
ShowForm --> UserInput: User dey put data
UserInput --> SaveData: Store for localStorage
SaveData --> FetchAPI: Collect carbon data
Returning --> LoadData: Read from localStorage
LoadData --> FetchAPI: Collect carbon data
FetchAPI --> ShowResults: Show data
ShowResults --> UserAction: User dey interact
UserAction --> Reset: Clear button click
UserAction --> ShowResults: See data
Reset --> ClearStorage: Remove saved data
ClearStorage --> FirstTime: Come back to setup
```
![Local storage pane](../../../../translated_images/localstorage.472f8147b6a3f8d1.pcm.png)
> ⚠️ **Security Consideration**: For production apps, to store API keys for LocalStorage fit cause security risks since JavaScript fit access dis data. For learning, dis way good, but real apps suppose use secure server-side storage for sensitive credentials.
## Handle form submission
Now make we manage wetin dey happen when pesin submit your form. By default, browsers dey reload page when forms submit, but we go stop dis to make experience smooth.
Dis one be like how mission control dey handle spacecraft communication - no be to reset everything for each time, dem just dey run continuously while dem dey process new info.
Make a function wey go capture form submission event and collect wetin user put:
```javascript
function handleSubmit(e) {
e.preventDefault();
setUpUser(apiKey.value, region.value);
}
```
**For di code above, we:**
- **Prevents** default form submission wey go refresh page
- **Extracts** user input from API key and region fields
- **Passes** form data go `setUpUser()` function for processing
- **Maintains** single-page app behavior by no reload page
✅ Remember say your HTML form fields get `required` attribute, so browser go check say user put both API key and region before dis function go run.
## Set up user preferences
Di `setUpUser` function dey responsible to save user credentials and to start di first API call. Dis one na to make smooth transition from setup to showing results.
```javascript
function setUpUser(apiKey, regionName) {
// Save di user credentials for future sessions
localStorage.setItem('apiKey', apiKey);
localStorage.setItem('regionName', regionName);
// Update UI to show say e dey load
loading.style.display = 'block';
errors.textContent = '';
clearBtn.style.display = 'block';
// Fetch carbon usage data wit di user's credentials
displayCarbonUsage(apiKey, regionName);
}
```
**Step by step, wetin dey happen:**
- **Saves** API key and region name for local storage to use for future
- **Shows** loading indicator to tell user say data dey fetch
- **Clears** any error messages wey dey before
- **Reveals** clear button make users fit reset their settings later
- **Starts** API call to fetch real carbon usage data
Dis function dey create smooth user experience by dey manage both data persistence and UI update for one go.
## Display carbon usage data
Now we go connect your extension to outside data sources through APIs. Dis one go turn your extension from standalone tool to something wey fit access real-time info from internet.
**Understanding APIs**
[APIs](https://www.webopedia.com/TERM/A/API.html) na how different apps dey yan to each other. Think am like telegraph system wey connect far towns for 19th century - operators go send requests to far stations and receive answers wit requested info. Anytime you check social media, ask voice assistant question, or use delivery app, na APIs dey facilitate dis data exchange.
```mermaid
flowchart TD
A[Your Extension] --> B[HTTP Request]
B --> C[CO2 Signal API]
C --> D{Valid Request?}
D -->|Yes| E[Query Database]
D -->|No| F[Return Error]
E --> G[Carbon Data]
G --> H[JSON Response]
H --> I[Your Extension]
F --> I
I --> J[Update UI]
subgraph "API Request"
K[Headers: auth-token]
L[Parameters: countryCode]
M[Method: GET]
end
subgraph "API Response"
N[Carbon Intensity]
O[Fossil Fuel %]
P[Timestamp]
end
style C fill:#e8f5e8
style G fill:#fff3e0
style I fill:#e1f5fe
```
**Key tori about REST APIs:**
- **REST** mean 'Representational State Transfer'
- **Uses** standard HTTP methods (GET, POST, PUT, DELETE) to waka wit data
- **Returns** data for predictable formats, mostly JSON
- **Provides** steady, URL-based endpoints for different requests
✅ Di [CO2 Signal API](https://www.co2signal.com/) wey we go use dey supply real-time carbon intensity data from electrical grids worldwide. Dis one dey help users understand how dem electricity use dey affect environment!
> 💡 **Understanding Asynchronous JavaScript**: Di [`async` keyword](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/async_function) make your code fit do many operations at once. When you dey request data from server, you no want say your whole extension go hang - dat one go be like air traffic control stop all work as e dey wait for one plane.
>
> **Key benefits:**
> - **Keep** extension dey respond while data dey load
> - **Allow** other code to continue during network requests
> - **Make** code easy to read pass old callback style
> - **Help** handle errors well during network waka
Here be quick video about `async`:
[![Async and Await for managing promises](https://img.youtube.com/vi/YwmlRkrxvkk/0.jpg)](https://youtube.com/watch?v=YwmlRkrxvkk "Async and Await for managing promises")
> 🎥 Click di picture on top for video about async/await.
### 🔄 **Pedagogical Check-in**
**Async Programming Understanding**: Before you start API function, make sure say you sabi:
- ✅ Why we dey use `async/await` no be to block di whole extension
- ✅ How `try/catch` dey handle network wahala well
- ✅ Difference between synchronous and asynchronous operations
- ✅ Why API calls fit fail and how to manage dis failures
**Real-World Connection**: Think about dis async examples:
- **Ordering food**: You no just dey wait for kitchen - you get receipt then continue other things
- **Sending emails**: Your email app no freeze while sending - you fit write more emails
- **Loading web pages**: Images dey load slow-slow while you fit already read text
**API Authentication Flow**:
```mermaid
sequenceDiagram
participant Ext as Extension
participant API as CO2 Signal API
participant DB as Database
Ext->>API: Request wit auth-token
API->>API: Validate token
API->>DB: Query carbon data
DB->>API: Return data
API->>Ext: JSON response
Ext->>Ext: Update UI
```
Make function to fetch and show carbon usage data:
```javascript
// Modern fetch API way (no need external dependencies)
async function displayCarbonUsage(apiKey, region) {
try {
// Fetch carbon intensity data from CO2 Signal API
const response = await fetch('https://api.co2signal.com/v1/latest', {
method: 'GET',
headers: {
'auth-token': apiKey,
'Content-Type': 'application/json'
},
// Add query parameters for the particular region
...new URLSearchParams({ countryCode: region }) && {
url: `https://api.co2signal.com/v1/latest?countryCode=${region}`
}
});
// Check if the API request dey successful
if (!response.ok) {
throw new Error(`API request failed: ${response.status}`);
}
const data = await response.json();
const carbonData = data.data;
// Calculate rounded carbon intensity value
const carbonIntensity = Math.round(carbonData.carbonIntensity);
// Update the user interface with di fetched data
loading.style.display = 'none';
form.style.display = 'none';
myregion.textContent = region.toUpperCase();
usage.textContent = `${carbonIntensity} grams (grams CO₂ emitted per kilowatt hour)`;
fossilfuel.textContent = `${carbonData.fossilFuelPercentage.toFixed(2)}% (percentage of fossil fuels used to generate electricity)`;
results.style.display = 'block';
// TODO: calculateColor(carbonIntensity) - go implement am for next lesson
} catch (error) {
console.error('Error fetching carbon data:', error);
// Show user-friendly error message
loading.style.display = 'none';
results.style.display = 'none';
errors.textContent = 'Sorry, we couldn\'t fetch data for that region. Please check your API key and region code.';
}
}
```
**Wetin dey happen here:**
- **Uses** modern `fetch()` API no use external libraries like Axios make code clean and no need dependencies
- **Implements** correct error checking with `response.ok` to catch API failure quick
- **Handles** async operation with `async/await` make code easy to read
- **Authenticates** wit CO2 Signal API using `auth-token` header
- **Parses** JSON data and take carbon intensity info
- **Updates** many UI elements wit formatted environment data
- **Shows** user-friendly error messages when API call fail
**Key modern JavaScript tori wey e show:**
- **Template literals** wit `${}` syntax to format strings cleanly
- **Error handling** wit try/catch block for robust apps
- **Async/await** pattern to handle network requests well
- **Object destructuring** to take specific data from API response
- **Method chaining** to do many DOM changes smooth
✅ Dis function dey show many important web dev skills - how to talk wit server, handle authentication, process data, update interface, and manage error well. Dis na core skill wey pro developers dey use every day.
```mermaid
flowchart TD
A[Stat API Call] --> B[Fetch Request]
B --> C{Network Success?}
C -->|No| D[Network Wahala]
C -->|Yes| E{Response OK?}
E -->|No| F[API Wahala]
E -->|Yes| G[Parse JSON]
G --> H{Valid Data?}
H -->|No| I[Data Wahala]
H -->|Yes| J[Update UI]
D --> K[Show Error Message]
F --> K
I --> K
J --> L[Hide Loading]
K --> L
style A fill:#e1f5fe
style J fill:#e8f5e8
style K fill:#ffebee
style L fill:#f3e5f5
```
### 🔄 **Pedagogical Check-in**
**Complete System Understanding**: Make sure you sabi full flow:
- ✅ How DOM references help JavaScript control interface
- ✅ Why local storage dey create persistence between browser session
- ✅ How async/await dey make API calls without freeze extension
- ✅ Wetin happen if API call fail and how to handle errors
- ✅ Why user experience get loading states and error messages
🎉 **Wetin you don do:** You don create browser extension wey:
- **Connects** to internet and get real environmental data
- **Persists** user settings between sessions
- **Handles** errors well no be to crash
- **Provides** smooth and professional user experience
Test your work by running `npm run build` and refresh your extension for browser. Now you get working carbon footprint tracker. Next lesson go add dynamic icon functionality to complete di extension.
---
## GitHub Copilot Agent Challenge 🚀
Use Agent mode to complete dis challenge:
**Description:** Make the browser extension beta by adding beta beta for error handling and better user experience features. This challenge go help you sabi how to work with APIs, local storage, and DOM manipulation using modern JavaScript style.
**Prompt:** Create better version of displayCarbonUsage function wey get: 1) Retry mechanism for API call wey fail with exponential backoff, 2) Check make sure say region code correct before you call API, 3) Loading animation with progress signs, 4) Cache API responses for localStorage with expiry time (cache for 30 minutes), and 5) Show historical data from previous API calls. Add correct TypeScript-style JSDoc comments to explain all function parameters and return types.
Learn more about [agent mode](https://code.visualstudio.com/blogs/2025/02/24/introducing-copilot-agent-mode) here.
## 🚀 Challenge
Make your understanding of APIs big by exploring beta beta browser-based APIs wey dey for web development. Choose one browser API and build small demonstration:
- [Geolocation API](https://developer.mozilla.org/docs/Web/API/Geolocation_API) - Get user current location
- [Notification API](https://developer.mozilla.org/docs/Web/API/Notifications_API) - Send desktop notifications
- [HTML Drag and Drop API](https://developer.mozilla.org/docs/Web/API/HTML_Drag_and_Drop_API) - Create interactive drag interfaces
- [Web Storage API](https://developer.mozilla.org/docs/Web/API/Web_Storage_API) - Advanced local storage techniques
- [Fetch API](https://developer.mozilla.org/docs/Web/API/Fetch_API) - Modern alternative to XMLHttpRequest
**Research questions to consider:**
- Wetin real-world problem dis API fit solve?
- How API dey handle errors and edge cases?
- Wetin be security things wey you for sabi when you dey use dis API?
- How many browsers dey support dis API?
After your research, find out wetin make API developer-friendly and reliable.
## Post-Lecture Quiz
[Post-lecture quiz](https://ff-quizzes.netlify.app/web/quiz/26)
## Review & Self Study
You don learn about LocalStorage and APIs for this lesson, both very useful for professional web developer. Fit you think how these two things go work together? Think how you go plan web site wey go save things for API use.
### ⚡ **Wetyn You Fit Do for Next 5 Minutes**
- [ ] Open DevTools Application tab and check localStorage for any website
- [ ] Create simple HTML form and test form validation for browser
- [ ] Try save and collect data using localStorage for browser console
- [ ] Check form data wey dey submit using Network tab
### 🎯 **Wetyn You Fit Finish This Hour**
- [ ] Finish post-lesson quiz and understand form handling ideas
- [ ] Build browser extension form wey go save user preferences
- [ ] Make client-side form validation with correct error messages
- [ ] Practice using chrome.storage API for extension data saving
- [ ] Create user interface wey respond to saved user settings
### 📅 **Your Week-Long Extension Building**
- [ ] Finish full browser extension with form function
- [ ] Master different storage ways: local, sync, and session storage
- [ ] Add advanced form features like autocomplete and validation
- [ ] Add import/export function for user data
- [ ] Test your extension well well across different browsers
- [ ] Make your extension user experience and error handling beta
### 🌟 **Your Month-Long Web API Mastery**
- [ ] Build complex app using different browser storage APIs
- [ ] Learn offline-first development pattern
- [ ] Contribute to open source projects about data saving
- [ ] Master privacy-focused development and GDPR compliance
- [ ] Create reusable libraries for form handling and data management
- [ ] Share knowledge about web APIs and extension development
## 🎯 Your Extension Development Mastery Timeline
```mermaid
timeline
title API Integration & Storage Learning Progression
section DOM Fundamentals (15 minutes)
Element References: querySelector mastery
: Event listener setup
: State management basics
section Local Storage (20 minutes)
Data Persistence: Key-value storage
: Session management
: User preference handling
: Storage inspection tools
section Form Handling (25 minutes)
User Input: Form validation
: Event prevention
: Data extraction
: UI state transitions
section API Integration (35 minutes)
External Communication: HTTP requests
: Authentication patterns
: JSON data parsing
: Response handling
section Async Programming (40 minutes)
Modern JavaScript: Promise handling
: Async/await patterns
: Error management
: Non-blocking operations
section Error Handling (30 minutes)
Robust Applications: Try/catch blocks
: User-friendly messages
: Graceful degradation
: Debugging techniques
section Advanced Patterns (1 week)
Professional Development: Caching strategies
: Rate limiting
: Retry mechanisms
: Performance optimization
section Production Skills (1 month)
Enterprise Features: Security best practices
: API versioning
: Monitoring & logging
: Scalable architecture
```
### 🛠️ Your Full-Stack Development Toolkit Summary
After you finish this lesson, you now get:
- **DOM Mastery**: Sharp element targeting and manipulation
- **Storage Expertise**: Persistent data management with localStorage
- **API Integration**: Real-time data fetching and authentication
- **Async Programming**: Non-blocking work with modern JavaScript
- **Error Handling**: Strong apps wey fit handle failure well
- **User Experience**: Loading states, validation, and smooth interactions
- **Modern Patterns**: fetch API, async/await, and ES6+ features
**Professional Skills We You Fit Get**: You don use patterns for:
- **Web Applications**: Single-page apps with external data sources
- **Mobile Development**: API-driven app with offline abilities
- **Desktop Software**: Electron apps with persistent storage
- **Enterprise Systems**: Authentication, caching, and error handling
- **Modern Frameworks**: React/Vue/Angular data management patterns
**Next Level**: You don ready to explore advanced topics like caching strategies, real-time WebSocket connections, or complex state management!
## Assignment
[Adopt an API](assignment.md)
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document don translate wit AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator). Even though we try make e correct, abeg remember say automatic translation fit get some mistake or no too correct. Di original document wey e dey for im own language na di correct one wey you suppose trust. For important information, na professional human translation dem recommend. We no go responsible if person misunderstand or misinterpret anything wey come from dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,109 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "25b8d28b8531352d4eb67291fd7824c4",
"translation_date": "2026-01-08T15:16:07+00:00",
"source_file": "5-browser-extension/2-forms-browsers-local-storage/assignment.md",
"language_code": "pcm"
}
-->
# Adopt an API
## Overview
APIs open up endless possibilities for creative web development! For dis assignment, you go pick one external API and build one browser extension wey go solve real problem or give users beta functionality.
## Instructions
### Step 1: Choose Your API
Choose one API from dis curated [list of free public APIs](https://github.com/public-apis/public-apis). Think about these categories:
**Popular options for beginners:**
- **Entertainment**: [Dog CEO API](https://dog.ceo/dog-api/) for random dog pictures
- **Weather**: [OpenWeatherMap](https://openweathermap.org/api) for current weather data
- **Quotes**: [Quotable API](https://quotable.io/) for inspirational quotes
- **News**: [NewsAPI](https://newsapi.org/) for current headlines
- **Fun Facts**: [Numbers API](http://numbersapi.com/) for interesting number facts
### Step 2: Plan Your Extension
Before you start to code, answer dis planning questions:
- Wetin your extension go solve?
- Who be your target user?
- Wetin you go store for local storage?
- How you go take handle API failures or rate limits?
### Step 3: Build Your Extension
Your extension suppose get:
**Required Features:**
- Form inputs for any required API parameters
- API integration with proper error handling
- Local storage for user preferences or API keys
- Clean, responsive user interface
- Loading states and user feedback
**Code Requirements:**
- Use modern JavaScript (ES6+) features
- Implement async/await for API calls
- Include proper error handling with try/catch blocks
- Add meaningful comments explaining your code
- Follow consistent code formatting
### Step 4: Test and Polish
- Test your extension with different inputs
- Handle edge cases (no internet, invalid API responses)
- Make sure your extension still dey work after browser restart
- Add user-friendly error messages
## Bonus Challenges
Take your extension go next level:
- Add multiple API endpoints for richer functionality
- Implement data caching to reduce API calls
- Create keyboard shortcuts for common actions
- Add data export/import features
- Implement user customization options
## Submission Requirements
1. **Working browser extension** wey successfully integrate with your chosen API
2. **README file** wey explain:
- Which API you choose and why
- How to install and use your extension
- Any API keys or setup wey dey required
- Screenshots of your extension in action
3. **Clean, commented code** wey dey follow modern JavaScript practices
## Rubric
| Criteria | Exemplary (90-100%) | Proficient (80-89%) | Developing (70-79%) | Beginning (60-69%) |
|----------|---------------------|---------------------|---------------------|--------------------|
| **API Integration** | Flawless API integration with comprehensive error handling and edge case management | Successful API integration with basic error handling | API works but get small error handling | API integration get serious problems |
| **Code Quality** | Clean, well-commented modern JavaScript wey follow best practices | Good code structure with enough comments | Code dey work but need beta organization | Poor code quality with minimal comments |
| **User Experience** | Polished interface with excellent loading states and user feedback | Good interface with basic user feedback | Basic interface wey fit work | Poor user experience with confusing interface |
| **Local Storage** | Sophisticated use of local storage with data validation and management | Proper implementation of local storage for key features | Basic local storage implementation | Small or incorrect use of local storage |
| **Documentation** | Comprehensive README with setup instructions and screenshots | Good documentation covering most requirements | Basic documentation wey miss some details | Poor or missing documentation |
## Getting Started Tips
1. **Start simple**: Choose API wey no need complex authentication
2. **Read the docs**: Understand well well your chosen API endpoints and responses
3. **Plan your UI**: Sketch your extension interface before coding
4. **Test frequently**: Build small small and test each feature as you add am
5. **Handle errors**: Always assume API calls fit fail so plan well
## Resources
- [Browser Extension Documentation](https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions)
- [Fetch API Guide](https://developer.mozilla.org/docs/Web/API/Fetch_API/Using_Fetch)
- [Local Storage Tutorial](https://developer.mozilla.org/docs/Web/API/Window/localStorage)
- [JSON Parsing and Handling](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/JSON)
Make you enjoy build beta and creative tin! 🚀
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document don translate wit AI translation service wey dem dey call [Co-op Translator](https://github.com/Azure/co-op-translator). Even though we dey try make am correct, abeg sabi say automated translation fit get some mistakes or no too correct. Di original document wey e dey for im own language na di correct one. If na serious matter, e good make human professional translate am. We no go take responsibility if person no understand or understand am wrong because of dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,596 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "b275fed2c6fc90d2b9b6661a3225faa2",
"translation_date": "2026-01-08T15:19:44+00:00",
"source_file": "5-browser-extension/3-background-tasks-and-performance/README.md",
"language_code": "pcm"
}
-->
# Browser Extension Project Part 3: Learn about Background Tasks and Performance
```mermaid
journey
title Your Performance Optimization Journey
section Foundation
Learn browser tools: 3: Student
Understand profiling: 4: Student
Identify bottlenecks: 4: Student
section Extension Features
Build color system: 4: Student
Create background tasks: 5: Student
Update icons dynamically: 5: Student
section Optimization
Monitor performance: 5: Student
Debug issues: 4: Student
Polish experience: 5: Student
```
You don waka ever wonder why some browser extensions dey feel sharp and responsive while others dey slow slow? Di koko na wetin dey happen for background. As users dey click tins for your extension interface, e get plenty background processes wey dey quietly manage data fetching, icon updates, and system resources.
Dis na di last lesson for di browser extension series, and we go make your carbon footprint tracker work smooth. You go add dynamic icon updates and learn how to see performance wahala before e become problem. E dey like tuning race car - small tinkerings fit make big difference for how everything dey run.
By di time we finish, you go get polished extension and sabi di performance principles wey separate good web apps from better ones. Make we dive enter di world of browser optimization.
## Pre-Lecture Quiz
[Pre-lecture quiz](https://ff-quizzes.netlify.app/web/quiz/27)
### Introduction
For our previous lessons, you don build form, connect am to API, and handle asynchronous data fetching. Your extension dey form well.
Now we need to add di last touches - like making di extension icon change color based on di carbon data. Dis remind me how NASA for optimize every system for Apollo spacecraft. Dem no fit waste any cycles or memory because lives depend on performance. Even tho our browser extension no too critical like dat, di same principles still dey apply - efficient code dey make better user experiences.
```mermaid
mindmap
root((Performance & Background Tasks))
Browser Performance
Rendering Pipeline
Asset Optimization
DOM Manipulation
JavaScript Execution
Profiling Tools
Developer Tools
Performance Tab
Timeline Analysis
Bottleneck Detection
Extension Architecture
Background Scripts
Content Scripts
Message Passing
Icon Management
Optimization Strategies
Code Splitting
Lazy Loading
Caching
Resource Compression
Visual Feedback
Dynamic Icons
Color Coding
Real-time Updates
User Experience
```
## Web Performance Basics
When your code dey run efficiently, people fit *feel* di difference. You sabi dat moment when page load straight-away or animation flow smooth? Na good performance dey work.
Performance no be only about speed - e mean say web experiences go dey natural and no go be clunky or frustrating. For early days of computing, Grace Hopper hold nanosecond (wire wey about one foot long) for her desk to show how far light fit travel inside one billionth of second. That na her way to explain why every microsecond matter for computing. Make we explore the detective tools wey fit help you see wetin dey slow things down.
> "Website performance na about two tins: how fast di page load, and how fast di code for am dey run." -- [Zack Grossbart](https://www.smashingmagazine.com/2012/06/javascript-profiling-chrome-developer-tools/)
Di topic on how to make your websites dey blazing fast for all kain devices, all kain users, and all kain situations, e big. Here some points to keep for mind as you dey build standard web project or browser extension.
Di first step for optimizing your site na to sabi wetin really dey happen under di hood. Luckily, your browser get powerful detective tools inside.
```mermaid
flowchart LR
A[HTML] --> B[Parse]
B --> C[DOM Tree]
D[CSS] --> E[Parse]
E --> F[CSSOM]
G[JavaScript] --> H[Execute]
C --> I[Render Tree]
F --> I
H --> I
I --> J[Layout]
J --> K[Paint]
K --> L[Composite]
L --> M[Display]
subgraph "Critical Rendering Path"
N["1. Parse HTML"]
O["2. Parse CSS"]
P["3. Run JS"]
Q["4. Build Render Tree"]
R["5. Arrange Elements"]
S["6. Paint Pixels"]
T["7. Join Layers"]
end
style M fill:#e8f5e8
style I fill:#fff3e0
style H fill:#ffebee
```
To open Developer Tools for Edge, click di three dots for top right corner, then go More Tools > Developer Tools. Or you fit use keyboard shortcut: `Ctrl` + `Shift` + `I` for Windows or `Option` + `Command` + `I` for Mac. Once you dey there, click Performance tab - na there you go do your investigation.
**Here your performance detective toolkit:**
- **Open** Developer Tools (you go dey use am well well as developer!)
- **Go** Performance tab - think am like your web app fitness tracker
- **Press** that Record button and watch your page dey do tins
- **Check** di results to see wetin dey slow things down
Make we try am. Open website (Microsoft.com good for this) and click 'Record' button. Now refresh di page and watch di profiler record everything wey dey happen. When you stop recording, you go see detailed breakdown of how browser 'scripts', 'renders', and 'paints' di site. E dey remind me how mission control dey monitor every system during rocket launch - you go get real-time data on exactly wetin dey happen and when.
![Edge profiler](../../../../translated_images/profiler.5a4a62479c5df01c.pcm.png)
✅ Di [Microsoft Documentation](https://docs.microsoft.com/microsoft-edge/devtools-guide/performance/?WT.mc_id=academic-77807-sagibbon) get plenty details if you wan deep dive
> Pro tip: Clear your browser cache before testing to see how your site perform for first-time visitors - e normally different from repeat visits!
Select elements for profile timeline to zoom on events wey happen while your page dey load.
Get snapshot of your page performance by selecting part of profile timeline and look summary pane:
![Edge profiler snapshot](../../../../translated_images/snapshot.97750180ebcad737.pcm.png)
Check Event Log pane to see if any event carry pass 15 ms:
![Edge event log](../../../../translated_images/log.804026979f3707e0.pcm.png)
✅ Get to sabi your profiler! Open developer tools for this site and check if any bottlenecks dey. Wetin be slowest-loading asset? Di fastest?
```mermaid
flowchart TD
A[Open DevTools] --> B[Go to Performance Tab]
B --> C[Click Record Button]
C --> D[Do Actions]
D --> E[Stop Recording]
E --> F{Analyze Results}
F --> G[Check Timeline]
F --> H[Review Network]
F --> I[Look Scripts]
F --> J[Find Paint Events]
G --> K{Long Tasks?}
H --> L{Big Assets?}
I --> M{Render Blocking?}
J --> N{Expensive Paints?}
K -->|Yes| O[Make JavaScript Better]
L -->|Yes| P[Compress Assets]
M -->|Yes| Q[Add Async/Defer]
N -->|Yes| R[Make Styles Simple]
O --> S[Test Again]
P --> S
Q --> S
R --> S
style A fill:#e1f5fe
style F fill:#fff3e0
style S fill:#e8f5e8
```
## Wetin to Look For When Profiling
Running profiler na only di beginning - di real skill na to sabi wetin those colorful charts dey tell you. No worry, you go sabi how to read dem. Experienced developers don learn how to spot warning signs before e turn big problem.
Make we talk about usual suspects - di performance wahala wey fit sneak inside web projects. Like how Marie Curie dey monitor radiation level well for her lab, we need to dey watch some patterns wey fit mean trouble. Catch am early to save you (and your users) plenty frustration.
**Asset sizes**: Websites don dey "heavy" over di years, and extra weight mostly come from images. E be like say we dey pack more tins for our digital suitcase.
✅ Check [Internet Archive](https://httparchive.org/reports/page-weight) to see how page sizes don grow - e dey very revealing.
**How keep your assets optimized:**
- **Compress** images! Modern format like WebP fit reduce file sizes well well
- **Serve** correct image size for each device - no need send big desktop images to phone dem
- **Minify** your CSS and JavaScript - every byte matter
- **Use** lazy loading so images go download only when users scroll come them
**DOM traversals**: Browser go build Document Object Model from di code you write, so na better page performance to keep your tags small, use and style only wetin di page need. Extra CSS for page fit need optimize; styles wey only need for one page no need to join main style sheet.
**Key strategies for DOM optimization:**
- **Minimizes** number of HTML elements and nesting levels
- **Removes** CSS rules wey no dey used and join stylesheets well well
- **Organizes** CSS to load only wetin needed for each page
- **Structures** HTML semantically so browser fit parse better
**JavaScript**: Every JavaScript developer suppose watch for 'render-blocking' scripts wey suppose load before di rest of DOM fit traverse and render. Try use `defer` with your inline scripts (like we do for Terrarium module).
**Modern JavaScript optimization techniques:**
- **Uses** `defer` attribute to load scripts after DOM parsing
- **Implements** code splitting to load only JavaScript wey necessary
- **Applies** lazy loading for non-critical work
- **Minimizes** use of heavy libraries and frameworks when fit
✅ Try some sites for [Site Speed Test website](https://www.webpagetest.org/) to learn common checks wey dem do to know site performance.
### 🔄 **Pedagogical Check-in**
**Performance Understanding**: Before you build extension features, make sure you fit:
- ✅ Explain critical rendering path from HTML go pixels
- ✅ Identify common performance bottlenecks for web apps
- ✅ Use browser developer tools to profile page performance
- ✅ Understand how asset size and DOM complexity dey affect speed
**Quick Self-Test**: Wetin happen if you get render-blocking JavaScript?
*Answer: Browser must download and run di script before e fit continue parsing HTML and render di page*
**Real-World Performance Impact**:
- **100ms delay**: Users go notice slowdown
- **1 second delay**: Users begin lose focus
- **3+ seconds**: 40% users go comot page
- **Mobile networks**: Performance dey even more important
Now say you get idea how browser dey render di assets you send am, make we see last tins you need do to complete your extension:
### Create a function to calculate color
Now we go create function wey go turn numerical data to meaningful colors. Think am like traffic light system - green mean clean energy, red mean high carbon intensity.
Dis function go take CO2 data from our API and decide which color best represent environmental impact. Na like how scientists dey use color-coding for heat maps to show complex data patterns - from ocean temperature to star formation. Make we add dis to `/src/index.js`, just after those `const` variables wey we set earlier:
```mermaid
flowchart LR
A[CO2 Value] --> B[Find Closest Scale Point]
B --> C[Get Scale Index]
C --> D[Map to Color]
D --> E[Send to Background]
subgraph "Color Scale"
F["0-150: Green (Clean)"]
G["150-600: Yellow (Moderate)"]
H["600-750: Orange (High)"]
I["750+: Brown (Very High)"]
end
subgraph "Message Passing"
J[Content Script]
K[chrome.runtime.sendMessage]
L[Background Script]
M[Icon Update]
end
style A fill:#e1f5fe
style D fill:#e8f5e8
style E fill:#fff3e0
```
```javascript
function calculateColor(value) {
// Define CO2 intensity scale (grams per kWh)
const co2Scale = [0, 150, 600, 750, 800];
// Corresponding colors from green (clean) to dark brown (high carbon)
const colors = ['#2AA364', '#F5EB4D', '#9E4229', '#381D02', '#381D02'];
// Find di closest scale value to we input
const closestNum = co2Scale.sort((a, b) => {
return Math.abs(a - value) - Math.abs(b - value);
})[0];
console.log(`${value} is closest to ${closestNum}`);
// Find di index for color mapping
const num = (element) => element > closestNum;
const scaleIndex = co2Scale.findIndex(num);
const closestColor = colors[scaleIndex];
console.log(scaleIndex, closestColor);
// Send color update message go background script
chrome.runtime.sendMessage({ action: 'updateIcon', value: { color: closestColor } });
}
```
**Make we break down dis clever small function:**
- **Sets up** two arrays - one for CO2 levels, another for colors (green = clean, brown = dirty!)
- **Finds** the closest match to actual CO2 value with some neat array sorting
- **Grabs** matching color with findIndex() method
- **Sends** message to Chrome background script with our chosen color
- **Uses** template literals (those backticks) for cleaner string formatting
- **Keeps** everything organized with const declarations
The `chrome.runtime` [API](https://developer.chrome.com/extensions/runtime) na like nervous system of your extension - e dey handle all behind-the-scenes communication and tasks:
> "Use chrome.runtime API to get background page, return details about manifest, and listen to respond to events for app or extension lifecycle. You fit also use dis API to convert relative path of URLs to full qualified URLs."
**Why Chrome Runtime API dey very handy:**
- **Lets** different parts of your extension dey talk
- **Handles** background work without freeze user interface
- **Manages** your extension lifecycle events
- **Makes** message passing between scripts easy well
✅ If you dey develop dis browser extension for Edge, e fit shock you say you dey use chrome API. Di newer Edge versions dey run for Chromium engine, so you fit use these tools.
```mermaid
architecture-beta
group browser(logos:chrome)[Browza]
service popup(logos:html5)[Popup UI] in browser
service content(logos:javascript)[Content Script] in browser
service background(database)[Background Script] in browser
service api(logos:api)[External API] in browser
popup:R -- L:content
content:R -- L:background
background:T -- B:api
content:T -- B:api
junction junctionCenter in browser
popup:R -- L:junctionCenter
junctionCenter:R -- L:background
```
> **Pro Tip**: If you want profile browser extension, open dev tools from inside the extension, because e be separate browser instance. Dis one go give you extension-specific performance metrics.
### Set a default icon color
Before we start fetch real data, make we give our extension starting point. Nobody like to dey look blank or broken icon. We go start with green color so users go sabi extension dey work from moment dem install am.
For your `init()` function, make we set default green icon:
```javascript
chrome.runtime.sendMessage({
action: 'updateIcon',
value: {
color: 'green',
},
});
```
**Wetin dis initialization dey do:**
- **Sets** neutral green color as default state
- **Gives** immediate visual feedback when extension dey load
- **Establishes** communication pattern with background script
- **Ensures** users go see functional extension before data load
### Call the function, execute the call
Now make we connect everything so that when fresh CO2 data land, your icon go update automatically with correct color. E be like connect final circuit for electronic device - suddenly all components go work as one system.
Add dis line just after you get CO2 data from API:
```javascript
// After we don collect CO2 data from the API
// make CO2 = data.data[0].intensity.actual;
calculateColor(CO2);
```
**Dis integration dey do:**
- **Connects** API data flow with visual indicator system
- **Triggers** icon updates automatically when new data show
- **Ensures** real-time visual feedback based on current carbon intensity
- **Maintains** separation of data fetching and display logic
Finally, for `/dist/background.js`, add listener for these background action calls:
```javascript
// Dey listen for messages wey come from content script
chrome.runtime.onMessage.addListener(function (msg, sender, sendResponse) {
if (msg.action === 'updateIcon') {
chrome.action.setIcon({ imageData: drawIcon(msg.value) });
}
});
// Draw dynamic icon use Canvas API
// Borrow from energy lollipop extension - na beta feature!
function drawIcon(value) {
// Create offscreen canvas make performance beta
const canvas = new OffscreenCanvas(200, 200);
const context = canvas.getContext('2d');
// Draw color circle wey represent carbon intensity
context.beginPath();
context.fillStyle = value.color;
context.arc(100, 100, 50, 0, 2 * Math.PI);
context.fill();
// Return di image data for di browser icon
return context.getImageData(50, 50, 100, 100);
}
```
**Wetin dis background script dey do:**
- **Listens** for messages from your main script (like receptionist wey dey take calls)
- **Processes** 'updateIcon' request to change your toolbar icon
- **Creates** new icons quickly with Canvas API
- **Draws** simple colored circle wey dey show current carbon intensity
- **Updates** your browser toolbar with fresh icon
- **Uses** OffscreenCanvas for smooth performance (no UI block)
✅ You go learn more about Canvas API for [Space Game lessons](../../6-space-game/2-drawing-to-canvas/README.md).
```mermaid
sequenceDiagram
participant CS as Content Script
participant BG as Background Script
participant Canvas as OffscreenCanvas
participant Browser as Browser Icon
CS->>BG: sendMessage({action: 'updateIcon', color})
BG->>Canvas: new OffscreenCanvas(200, 200)
Canvas->>Canvas: getContext('2d')
Canvas->>Canvas: beginPath() + fillStyle + arc()
Canvas->>Canvas: fill() + getImageData()
Canvas->>BG: Return image data
BG->>Browser: chrome.action.setIcon(imageData)
Browser->>Browser: Update toolbar icon
```
### 🔄 **Pedagogical Check-in**
**Complete Extension Understanding**: Check your mastery for whole system:
- ✅ How message passing dey work between different extension scripts?
- ✅ Why we use OffscreenCanvas instead of regular Canvas for better performance?
- ✅ Wetin be di role wey Chrome Runtime API dey play for extension architecture?
- ✅ How di color calculation algorithm dey map data go visual feedback?
**Performance Considerations**: Your extension don now show:
- **Efficient messaging**: Clear communication between script contexts
- **Optimized rendering**: OffscreenCanvas dey stop UI from blocking
- **Real-time updates**: Dynamic icon dey change based on live data
- **Memory management**: Correct cleanup and handling of resource
**Time to test your extension:**
- **Build** everything with `npm run build`
- **Reload** your extension for the browser (no forget dis step)
- **Open** your extension and watch di icon change colors
- **Check** how e dey respond to real carbon data from around di world
Now you go sabi sharp sharp whether na good time for dat load of laundry or if you gats wait for cleaner energy. You don just build something wey really useful and learn about browser performance as you go.
## GitHub Copilot Agent Challenge 🚀
Use di Agent mode to complete dis challenge:
**Description:** Improve di browser extension's performance monitoring power by adding a feature wey go track and show load times for different parts of di extension.
**Prompt:** Make a performance monitoring system for di browser extension wey go measure and log di time e dey take to fetch CO2 data from di API, calculate colors, and update di icon. Add function called `performanceTracker` wey dey use di Performance API to measure these operations and show di results for di browser console with timestamps and duration metrics.
Learn more about [agent mode](https://code.visualstudio.com/blogs/2025/02/24/introducing-copilot-agent-mode) here.
## 🚀 Challenge
Here be one interesting detective mission: choose some open source websites wey don dey for years (like Wikipedia, GitHub, or Stack Overflow) and check their commit history. You fit see wetin dem do for performance improvement? Wetin be di problems wey dey always come up?
**Your investigation approach:**
- **Search** commit messages for words like "optimize," "performance," or "faster"
- **Look** for patterns - dem dey always fix di same kind issues?
- **Identify** di common wahala wey dey slow down websites
- **Share** wetin you find - other developers go learn from real-world example
## Post-Lecture Quiz
[Post-lecture quiz](https://ff-quizzes.netlify.app/web/quiz/28)
## Review & Self Study
Try sign up for one [performance newsletter](https://perf.email/)
Check some ways wey browsers dey measure web performance by using di performance tabs inside their web tools. You find any big difference?
### ⚡ **Wetyn You Fit Do for Di Next 5 Minutes**
- [ ] Open browser Task Manager (Shift+Esc for Chrome) to see extension resource usage
- [ ] Use DevTools Performance tab to record and analyze webpage performance
- [ ] Check di browser's Extensions page to see which extensions dey affect startup time
- [ ] Try turn off some extensions for small time to see performance differences
### 🎯 **Wetyn You Fit Achieve for Dis Hour**
- [ ] Finish di post-lesson quiz and understand performance concepts
- [ ] Build one background script for your browser extension
- [ ] Learn how to use browser.alarms for efficient background tasks
- [ ] Practice message passing between content scripts and background scripts
- [ ] Measure and optimize your extension's resource usage
### 📅 **Your Week-Long Performance Journey**
- [ ] Finish one high-performance browser extension with background functionality
- [ ] Master service workers and modern extension architecture
- [ ] Build efficient data synchronization and caching strategies
- [ ] Learn advanced debugging techniques for extension performance
- [ ] Optimize your extension for both functionality and resource efficiency
- [ ] Create comprehensive tests for extension performance scenarios
### 🌟 **Your Month-Long Optimization Mastery**
- [ ] Build enterprise-grade browser extensions with optimal performance
- [ ] Learn about Web Workers, Service Workers, and modern web performance
- [ ] Contribute to open source projects focused on performance optimization
- [ ] Master browser internals and advanced debugging techniques
- [ ] Create performance monitoring tools and best practices guides
- [ ] Become a performance expert wey dey help optimize web applications
## 🎯 Your Browser Extension Mastery Timeline
```mermaid
timeline
title Complete Extension Development Progression
section Performance Fundamentals (20 minutes)
Browser Profiling: DevTools mastery
: Timeline analysis
: Bottleneck identification
: Critical rendering path
section Background Tasks (25 minutes)
Extension Architecture: Message passing
: Background scripts
: Runtime API usage
: Cross-context communication
section Visual Feedback (30 minutes)
Dynamic UI: Color calculation algorithms
: Canvas API integration
: Icon generation
: Real-time updates
section Performance Optimization (35 minutes)
Efficient Code: Async operations
: Memory management
: Resource cleanup
: Performance monitoring
section Production Ready (45 minutes)
Polish & Testing: Cross-browser compatibility
: Error handling
: User experience
: Performance validation
section Advanced Features (1 week)
Extension Ecosystem: Chrome Web Store
: User feedback
: Analytics integration
: Update management
section Professional Development (2 weeks)
Enterprise Extensions: Team collaboration
: Code reviews
: CI/CD pipelines
: Security audits
section Expert Mastery (1 month)
Platform Expertise: Advanced Chrome APIs
: Performance optimization
: Architecture patterns
: Open source contribution
```
### 🛠️ Your Complete Extension Development Toolkit
After you don finish dis trilogy, you don master:
- **Browser Architecture**: Deep understanding how extensions dey join browser systems
- **Performance Profiling**: Fit identify and fix bottlenecks with developer tools
- **Async Programming**: Modern JavaScript styles for responsive and non-blocking operations
- **API Integration**: External data fetching with authentication and error handling
- **Visual Design**: Dynamic UI updates and Canvas-based graphics generation
- **Message Passing**: Communication between scripts for extension architectures
- **User Experience**: Loading states, error handling, and easy to use interactions
- **Production Skills**: Testing, debugging, and optimization for real-world usage
**Real-World Applications**: Your skills for extension development apply direct to:
- **Progressive Web Apps**: Similar architecture and performance patterns
- **Electron Desktop Apps**: Cross-platform apps wey dey use web technologies
- **Mobile Hybrid Apps**: Cordova/PhoneGap development using web APIs
- **Enterprise Web Applications**: Complex dashboard and productivity tools
- **Chrome DevTools Extensions**: Advanced developer tooling and debugging
- **Web API Integration**: Any app wey dey talk with external services
**Professional Impact**: You fit now:
- **Build** production-ready browser extensions from concept go deployment
- **Optimize** web application performance using industry-standard profiling tools
- **Architect** scalable systems with proper separation of concerns
- **Debug** complex async operations and cross-context communication
- **Contribute** to open source extension projects and browser standards
**Next Level Opportunities**:
- **Chrome Web Store Developer**: Publish extensions for millions of users
- **Web Performance Engineer**: Specialize for optimization and user experience
- **Browser Platform Developer**: Help develop browser engine
- **Extension Framework Creator**: Build tools wey go help other developers
- **Developer Relations**: Share knowledge through teaching and content creation
🌟 **Achievement Unlocked**: You don build one complete, functional browser extension wey show professional development skills and modern web standards!
## Assignment
[Analyze a site for performance](assignment.md)
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document don translate with AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator). Even though we dey try make am correct, abeg sabi say machine translation fit get mistake or waka wrong. Di original document for im own language na di main correct source. If na serious information, make person wey sabi human translation do am. We no go responsible if person no understand well or if dem use dis translation anyhow.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,109 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "a203e560e58ccc6ba68bffc40c7c8676",
"translation_date": "2026-01-08T15:31:03+00:00",
"source_file": "5-browser-extension/3-background-tasks-and-performance/assignment.md",
"language_code": "pcm"
}
-->
# Analyze wan site for performance
## Assignment Overview
Performance analysis na important skill for modern web developers. For this assignment, you go have to do detailed performance audit for real website, using both browser-based tools and third-party services to find bottlenecks and suggest how to optimize am.
Your work na to provide detailed performance report wey go show how you sabi web performance principles and how you fit use professional analysis tools well-well.
## Assignment Instructions
**Choose one website** for analysis - pick one from the options wey follow:
- One popular website wey you dey use often (news site, social media, e-commerce)
- One open-source project website (GitHub pages, documentation sites)
- One local business website or portfolio site
- Your own project or previous coursework
**Do multi-tool analysis** using at least three different ways:
- **Browser DevTools** - Use Chrome/Edge Performance tab for detailed profiling
- **Online auditing tools** - Try Lighthouse, GTmetrix, or WebPageTest
- **Network analysis** - Look resource loading, file sizes, and request patterns
**Document your findings** for one complete report wey get:
### Performance Metrics Analysis
- **Load time measurements** from many tools and viewpoints
- **Core Web Vitals** scores (LCP, FID, CLS) and wetin dem mean
- **Resource breakdown** showing which assets dey contribute most to load time
- **Network waterfall analysis** wey identify blocking resources
### Problem Identification
- **Specific performance bottlenecks** with data wey support am
- **Root cause analysis** wey explain why each problem happen
- **User impact assessment** wey describe how the problems affect real users
- **Priority ranking** of issues based on how serious and how e hard to fix
### Optimization Recommendations
- **Specific, actionable improvements** with expected impact
- **Implementation strategies** for each recommended change
- **Modern best practices** wey fit apply (lazy loading, compression, etc.)
- **Tools and techniques** for ongoing performance monitoring
## Research Requirements
**No rely only on browser tools** - expand your analysis with:
**Third-party auditing services:**
- [Google Lighthouse](https://developers.google.com/web/tools/lighthouse) - Full audits
- [GTmetrix](https://gtmetrix.com/) - Performance and optimization insights
- [WebPageTest](https://www.webpagetest.org/) - Real-world testing conditions
- [Pingdom](https://tools.pingdom.com/) - Global performance monitoring
**Specialized analysis tools:**
- [Bundle Analyzer](https://bundlephobia.com/) - JavaScript bundle size analysis
- [Image optimization tools](https://squoosh.app/) - Asset optimization opportunities
- [Security headers analysis](https://securityheaders.com/) - Security performance impact
## Deliverables Format
Make one professional report (2-3 pages) wey get:
1. **Executive Summary** - Main findings and recommendations overview
2. **Methodology** - Tools wey you use and how you do the testing
3. **Current Performance Assessment** - Baseline metrics and measurements
4. **Issues Identified** - Detailed problem analysis with supporting data
5. **Recommendations** - Prioritized improvement plans
6. **Implementation Roadmap** - Step-by-step optimization plan
**Include visual evidence:**
- Screenshots of performance tools and metrics
- Charts or graphs showing performance data
- Before/after comparisons where e fit
- Network waterfall charts and resource breakdowns
## Rubric
| Criteria | Exemplary (90-100%) | Adequate (70-89%) | Needs Improvement (50-69%) |
| -------- | ------------------- | ----------------- | -------------------------- |
| **Analysis Depth** | Comprehensive analysis using 4+ tools with detailed metrics, root cause analysis, and user impact assessment | Good analysis using 3 tools with clear metrics and basic problem identification | Basic analysis using 2 tools with limited depth and minimal problem identification |
| **Tool Diversity** | Uses browser tools + 3+ third-party services with comparative analysis and insights from each | Uses browser tools + 2 third-party services with some comparative analysis | Uses browser tools + 1 third-party service with limited comparison |
| **Problem Identification** | Identifies 5+ specific performance issues with detailed root cause analysis and quantified impact | Identifies 3-4 performance issues with good analysis and some impact measurement | Identifies 1-2 performance issues with basic analysis |
| **Recommendations** | Provides specific, actionable recommendations with implementation details, expected impact, and modern best practices | Provides good recommendations with some implementation guidance and expected outcomes | Provides basic recommendations with limited implementation details |
| **Professional Presentation** | Well-organized report with clear structure, visual evidence, executive summary, and professional formatting | Good organization with some visual evidence and clear structure | Basic organization with minimal visual evidence |
## Learning Outcomes
By completing this assignment, you go show say you fit:
- **Apply** professional performance analysis tools and methodologies
- **Identify** performance bottlenecks using data-driven analysis
- **Analyze** the relationship between code quality and user experience
- **Recommend** specific, actionable optimization strategies
- **Communicate** technical findings in professional way
This assignment dey reinforce the performance concepts wey you learn for the lesson and help you build practical skills wey you go use for your entire web development career.
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document na to say e don be translated wit AI translation service wey dem call [Co-op Translator](https://github.com/Azure/co-op-translator). Even though we try make am correct, abeg sabi say automated translation fit get mistake or no clear. Di original document wey e dey for dia language na di one wey get correct info. If na important info, make person wey sabi translate for human do am. We no go take any wahala or kasala wey fit happen if person no understand or interpret dis translation well well.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,43 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "b121a279a6ab39878491f3e572673515",
"translation_date": "2026-01-08T11:17:54+00:00",
"source_file": "5-browser-extension/README.md",
"language_code": "pcm"
}
-->
# Building a browser extension
Building browser extensions na fun and interesting way to dey think about how your apps go perform while you dey build different kain web asset. Dis module get lessons on how browsers dey work and how to deploy browser extension, how to build form, call API, and use local storage, plus how to check how your website dey perform and improve am.
You go build browser extension wey go work for Edge, Chrome, and Firefox. Dis extension, wey be like small mini web site wey dem tailor make for one correct task, dey check [C02 Signal API](https://www.co2signal.com) to see how one region dey use electricity and how many carbon e dey release, then e go give reading on the carbon footprint of the region.
Dis extension fit be call ad hoc by user once dem put API key and region code inside form to find local electricity use and then give data wey fit affect how user go take use electricity. For example, e fit better to delay to run clothes dryer (wey dey carbon intense) when electricity usage high for your region.
### Topics
1. [About the browser](1-about-browsers/README.md)
2. [Forms and local storage](2-forms-browsers-local-storage/README.md)
3. [Background tasks and performance](3-background-tasks-and-performance/README.md)
### Credits
![a green browser extension](../../../translated_images/extension-screenshot.0e7f5bfa110e92e3.pcm.png)
## Credits
Idea for dis web carbon trigger na from Asim Hussain, wey be lead at Microsoft for Green Cloud Advocacy team and na author of [Green Principles](https://principles.green/). E first be [web site project](https://github.com/jlooper/green).
Structure of this browser extension get influence from [Adebola Adeniran's COVID extension](https://github.com/onedebos/covtension).
The concept wey dey the 'dot' icon system come from the icon structure of the [Energy Lollipop](https://energylollipop.com/) browser extension for California emissions.
These lessons na [Jen Looper](https://www.twitter.com/jenlooper) write with ♥️.
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document na AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator) wey translate am. Even though we try make e correct, make you sabi say machine translation fit get some error or no too clear. The original document wey e dey for im original language na the correct one wey you suppose trust pass. If na serious matter, e good make person wey sabi do human translation help you. We no go carry any wahala if anybody misunderstand or no sabi well because of this translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,43 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "fab4e6b4f0efcd587a9029d82991f597",
"translation_date": "2026-01-08T15:57:35+00:00",
"source_file": "5-browser-extension/solution/README.md",
"language_code": "pcm"
}
-->
# Carbon Trigger Browser Extension: Completed Code
Using tmrow's C02 Signal API to track electricity usage, build a browser extension so that you fit get reminder right for your browser about how heavy your region's electricity usage be. Using this extension ad hoc go help you make judgement calls on your activities based on this information.
![extension screenshot](../../../../translated_images/extension-screenshot.0e7f5bfa110e92e3.pcm.png)
## Getting Started
You go need get [npm](https://npmjs.com) installed. Download copy of this code for folder for your computer.
Install all di required packages:
```
npm install
```
Build di extension from webpack
```
npm run build
```
To install for Edge, use di 'three dot' menu for di top right corner of di browser to find di Extensions panel. From there, select 'Load Unpacked' to load new extension. Open di 'dist' folder when dem ask you and di extension go load. To use am, you need API key for CO2 Signal's API ([get one here via email](https://www.co2signal.com/) - put your email for di box for dis page) plus di [code for your region](http://api.electricitymap.org/v3/zones) wey match di [Electricity Map](https://www.electricitymap.org/map) (for Boston, as example, I dey use 'US-NEISO').
![installing](../../../../translated_images/install-on-edge.78634f02842c4828.pcm.png)
Once di API key and region don enter for di extension interface, di colored dot wey dey di browser extension bar go change to show how your region energy use dey and go give you hint on which energy-heavy activities fit make sense for you to do. Di idea behind dis 'dot' system na wetin di [Energy Lollipop extension](https://energylollipop.com/) give me for California emissions.
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document don translate wit AI translation service wey dem dey call [Co-op Translator](https://github.com/Azure/co-op-translator). Even though we dey try make am correct, abeg sabi say machine translation fit get some small mistake or no too correct. Di original document for dia own language na di correct one. If na serious matter, e good make human expert translate am. We no responsible if mistake or wrong meaning show because of dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,43 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "cbaf73f94a9ab4c680a10ef871e92948",
"translation_date": "2026-01-08T16:08:59+00:00",
"source_file": "5-browser-extension/solution/translation/README.es.md",
"language_code": "pcm"
}
-->
# Carbon Trigger Browser Extension: Full Code
Using tmrow's CO2 signal API to track electricity use, make a browser extension so you fit get reminder directly for your browser about your area's electricity consumption. This kind extension go help you take decisions about your activities based on this information.
![extension screenshot](../../../../../translated_images/extension-screenshot.352c4c3ba54e4041.pcm.png)
## Getting Started
You gats get [npm](https://npmjs.com) installed. Download one copy of this code for one folder for your computer.
Install all the necessary packages:
```
npm install
```
Build the extension from webpack:
```
npm run build
```
To install for Edge, use the 'three dots' menu for the top right corner of the browser to find the Extensions panel. From there, select 'Load unpacked' to load new extension. Open the 'dist' folder wen dem ask you and the extension go load. To use am, you go need API key for CO2 Signal API ([get one here by email](https://www.co2signal.com/) - enter your email for the box on this page) and the [code for your area](http://api.electricitymap.org/v3/zones) wey match the [Electricity map](https://www.electricitymap.org/map) (for Boston, for example, I dey use 'US- NEISO').
![installing](../../../../../translated_images/install-on-edge.8bd0ee3ca7dcda1c.pcm.png)
Once you don enter the API key and the region for the extension interface, the color dot for the browser extension bar go change to show how your area's energy use dey and give you one signal about high energy consumption activities wey go make sense for you. The idea behind this "dot" system I get am from the [Energy Lollipop extension](https://energylollipop.com/) for California emissions.
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document don translate wit AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator). Even tho we dey try make am correct, abeg sabi say automated translation fit get mistake or no exactly correct. The original document wey e come from na im get final authority. For important information, make person wey sabi do professional human translation help you. We no go take responsibility if person no understand or misinterpret anything from dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,43 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "9361268ca430b2579375009e1eceb5e5",
"translation_date": "2026-01-08T16:11:15+00:00",
"source_file": "5-browser-extension/solution/translation/README.fr.md",
"language_code": "pcm"
}
-->
# Extension de navigateur Carbon Trigger: Completed Code
En dey use API C02 Signal wey tmrow get to track how electricity dey consume, make you build browser extension so dat you fit get reminder straight for your browser about how much electricity your area dey use. Using dis kind ad hoc extension go help you make better judgment about your activities based on dis info.
![capture d'extension](../../../../../translated_images/extension-screenshot.0e7f5bfa110e92e3.pcm.png)
## Débuter
You go need to get [npm](https://npmjs.com) install. Download one copy of dis code for one folder for your computer.
Install all di packages wey you need:
```
npm install
```
Build di extension from webpack
```
npm run build
```
To install for Edge, use di 'three dots' menu for di top right corner of your browser to find di Extensions panel. From there, select 'Load unpacked extension' to load new extension. Open di 'dist' folder when e ask and di extension go load. To use am, you need API key for CO2 Signal API ([get one here by email](https://www.co2signal.com/) - put your email for di box for dis page) plus di [code for your region](http://api.electricitymap.org/v3/zones) wey match with di [Electricity map](https://www.electricitymap.org/map) (for example, for Boston, I use 'US- NEISO').
![installation](../../../../../translated_images/install-on-edge.78634f02842c4828.pcm.png)
Once you don enter di API key and region inside extension interface, di colored dot for di browser extension bar go change to show how much power your area dey consume and e go give you sign about which energy-heavy activities e go good make you do. Di idea behind dis 'points' system na from di [Energy Lollipop extension](https://energylollipop.com/) wey dem make for California emissions.
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document don translate wit AI translation service wey dem dey call [Co-op Translator](https://github.com/Azure/co-op-translator). Even though we dey try make am correct, abeg sabi say automatic translation fit get some errors or wrong tins. Di original document wey dem write for im own language na im be di main correct source. If na serious mata be dat, better to use professional human translation. We no go take responsibility for any misunderstanding or wrong meaning wey fit show from dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,43 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "dd58ae1b7707034f055718c1b68bc8de",
"translation_date": "2026-01-08T16:06:34+00:00",
"source_file": "5-browser-extension/solution/translation/README.hi.md",
"language_code": "pcm"
}
-->
# Carbon Trigger Browser Extension: Complete Code
To track electricity usage, use tmrow's CO2 Signal API to build a browser extension wey go remind you how heavy di electricity usage be for your area for your browser. Using dis temporary extension go help you decide your activities based on dis information.
![Extension Screenshot ](../../../../../translated_images/extension-screenshot.0e7f5bfa110e92e3.pcm.png)
## Getting Started
You go need to install [npm](https://npmjs.com). Download one copy of dis code inside one folder for your computer.
Install all the necessary packages:
```
npm install
```
Build di extension using webpack
```
npm run build
```
To install for Edge, use di 'three-dot' menu for di top right corner of your browser to find di extension panel. From there, choose 'Load unpacked' to load new extension. Open di 'dist' folder at di prompt and di extension go load. To use am, you need an API key for di CO2 Signal API ([get am here via email](https://www.co2snal.com/) - enter your email for di box on dis page) and [code for your region](http://api.electricitymap.org/v3/zones) from [Electricity Map](https://www.electricitymap.org/map) (For example, for Boston, I dey use 'US-NEISO').
![installing](../../../../../translated_images/install-on-edge.78634f02842c4828.pcm.png)
Once you don input di API key and region inside di extension interface, di colored dot for di browser extension bar suppose change to reflect how di energy use be for your area and also show you one indicator wey go tell you which energy-heavy activities fit be good for your performance. Di idea behind dis 'dot' system na from the California emissions [Energy Lollipop Extension](https://energylollipop.com/) wey I jaga.
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis dokument don translate by AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator). Even though we dey try make am correct, abeg sabi say automated translation fit get some mistakes or no-too-correct parts. The original dokument for im own language na im get correct authority. If na important info, e better make human professional translate am. We no go responsible if person waka mistake or misunderstand tins because of dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,43 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "9a6b22a2eff0f499b66236be973b24ad",
"translation_date": "2026-01-08T16:16:43+00:00",
"source_file": "5-browser-extension/solution/translation/README.it.md",
"language_code": "pcm"
}
-->
# Estensione del browser Carbon Trigger: kòd wey make you fit start
We go use API Signal C02 from tmrow to dey monitor how people dey use electricity to make browser extension wey go dey remind you inside your browser how heavy electricity use be for your area. Dis kind extension go help you to sabi how your activities dey affect electricity use based on dis info.
![videata dell'estensione](../../../../../translated_images/extension-screenshot.0e7f5bfa110e92e3.pcm.png)
## To Start
You go need make sure say [npm](https://npmjs.com) dey installed. Download copy of dis code put am for folder for your computer.
Make you install all di packages wey you need:
```
npm install
```
Make you create the extension using webpack
```
npm run build
```
To install am for Edge, use di "three dots" menu for top right corner for browser to find Extensions panel. If "Developer Mode" no dey enabled, enable am (e dey for bottom left). Choose "Load unpacked" to load new extension. Open "dist" folder for prompt and the extension go load. To use am, you need API key for CO2 Signal API (you fit [get am here via email](https://www.co2signal.com/) - put your email for the box for dat page) and [code for your region](http://api.electricitymap.org/v3/zones) wey match di [electricity map](https://www.electricitymap.org/map) (for Boston, for example, na "US-NEISO").
![installazione](../../../../../translated_images/install-on-edge.78634f02842c4828.pcm.png)
Once API key and region don enter for the extension interface, the colored dot for the browser extension bar suppose change to show your region energy use and give hint about which high energy activities fit make sense to run. The idea wey behind dis "dots" system na from [Energy Lollipop extension](https://energylollipop.com/) wey dem make for California emissions.
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document don translate wit AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator). Even tho we dey try make am accurate, abeg sabi say automated translations fit get errors or mistakes. Di original document wey written for im correct language na di main tori. If na serious information, make person professional human translator check am. We no go responsible for any confusion or wrong understanding wey fit happen because of dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,43 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "3f5e6821e0febccfc5d05e7c944d9e3d",
"translation_date": "2026-01-08T16:13:12+00:00",
"source_file": "5-browser-extension/solution/translation/README.ja.md",
"language_code": "pcm"
}
-->
# Kaabon Trigger Browser Extension: Di Complete Code
Wi go build browser extension wey go fit show reminder for your browser to track how much power una dey use for your area using tmrow C02 Signal API. Dis extension go help you judge your activities based on dis information if you use am adhoc.
![extension screenshot](../../../../../translated_images/extension-screenshot.0e7f5bfa110e92e3.pcm.png)
## Getting Started
You go need get [npm](https://npmjs.com) installed. Download di copy of dis code into folder for your computer.
Install all di packages wey you need.
```
npm install
```
Build di extension from webpack.
```
npm run build
```
To install for Edge, find di "3 dots" menu for di top right corner of di browser then find "Extensions" panel. From dia select "Load Unpacked" to load di new extension. When prompt show, open di "dist" folder and di extension go load. To use am, you go need CO2 Signal API key ([get one here via email](https://www.co2signal.com/) - just put your email for di box for dis page) and di [Electricity Map](https://www.electricitymap.org/map) code for your region (for Boston, we dey use 'US-NEISO' for example).
![installing](../../../../../translated_images/install-on-edge.78634f02842c4828.pcm.png)
Once you put your API key and region for di extension interface, di colored dot wey dey show for di browser extension bar go change to reflect your area energy usage and show which kind energy activity you suppose do. Dis "dot" system idea na from di [Energy Lollipop extension](https://energylollipop.com/) wey I see for California state emission.
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document na AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator) weh translate am. Even though we try make am correct, abeg sabi say automated translation fit get errors or mistake. Di original document wey dem write for im correct language na di real correct one. If na serious matter, e better make professional human translator do am. We no go responsible for any misunderstanding or wrong meaning wey fit come from using dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,43 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "21b364c158c8e4f698de65eeac16c9fe",
"translation_date": "2026-01-08T16:14:56+00:00",
"source_file": "5-browser-extension/solution/translation/README.ms.md",
"language_code": "pcm"
}
-->
# Carbon Trigger Browser Extension: Complete Code
Using the CO2 Signal API tmrow to detect electricity usage, build a browser extension so you fit get reminder for your browser about how heavy your region electricity use be. Using this extension specifically go help you make decisions about your activity based on this information.
![browser extension screenshot](../../../../../translated_images/extension-screenshot.0e7f5bfa110e92e3.pcm.png)
## Start Here
You need to install [npm](https://npmjs.com). Download copy of this code to folder for your computer.
Install all the packages wey you need:
```
npm install
```
Build the extension from webpack
```
npm run build
```
To install for Edge, use the 'three dots' menu for the top right corner of browser to find Extensions panel. From there, choose 'Load Unpacked' to load new extension. Open the 'dist' folder on request and the extension go load. To use am, you need API key for CO2 Signal API ([get one here via email](https://www.co2signal.com/) - enter your email inside the box for this page) and [code for your region](http://api.electricitymap.org/v3/zones) wey match the [Electricity Map](https://www.electricitymap.org/map) (for Boston, for example, I use 'US-NEISO').
![downloading](../../../../../translated_images/install-on-edge.78634f02842c4828.pcm.png)
Once the API key and region don enter into the extension interface, the coloured dot for the browser extension bar go change to show your region electricity usage and give you idea about the kind heavy activities wey make sense for you to do. The concept behind the 'dot' system dem give me from [Energy Lollipop browser extension](https://energylollipop.com/) for California emissions.
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document don translate wit AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator). Even though we dey try make am correct, make you sabi say automated translations fit get mistakes or no too correct. Di original document wey e base for e own language na di correct source. If na important tins, na professional human translation better. We no dey responsible for any wahala or wrong understanding wey fit happen from dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,43 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "26fd39046d264ba185dcb086d3a8cf3e",
"translation_date": "2026-01-08T16:00:02+00:00",
"source_file": "5-browser-extension/start/README.md",
"language_code": "pcm"
}
-->
# Carbon Trigger Browser Extension: Starter Code
Using tmrow's C02 Signal API to track electricity usage, build a browser extension so that you fit get reminder for your browser about how heavy your regiohn dem electricity usage be. Using this extension sometimes go help you make correct judgement on top your activities based on this information.
![extension screenshot](../../../../translated_images/extension-screenshot.0e7f5bfa110e92e3.pcm.png)
## Getting Started
You go need get [npm](https://npmjs.com) installed. Download copy of this code go one folder for your computer.
Install all the required packages:
```
npm install
```
Build the extension from webpack
```
npm run build
```
To install for Edge, use the 'three dot' menu for top right corner of the browser to find the Extensions panel. From there, select 'Load Unpacked' to load new extension. Open the 'dist' folder when e ask and the extension go load. To use am, you go need API key for CO2 Signal's API ([get one here via email](https://www.co2signal.com/) - put your email for the box for this page) and the [code for your region](http://api.electricitymap.org/v3/zones) wey match the [Electricity Map](https://www.electricitymap.org/map) (for Boston, for example, I dey use 'US-NEISO').
![installing](../../../../translated_images/install-on-edge.78634f02842c4828.pcm.png)
Once you input the API key and region for the extension interface, the colored dot for the browser extension bar go change to show how your region dey use energy and give you pointer on which energy-heavy activities fit beta for you to do. The idea for this 'dot' system na from the [Energy Lollipop extension](https://energylollipop.com/) for California emissions.
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis dokumant don translate wit AI translation service wey dem call [Co-op Translator](https://github.com/Azure/co-op-translator). Even though we dey try make am correct, abeg sabi say automated translation fit get mistake or no too correct. Di original dokumant wey dey im original language na di main correct source. If na serious mata, make person wey sabi translate am proper do am. We no go responsible if pesin no understand or misunderstand any tin wey happen because of dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,662 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "a6332a7bb4d0be3bfd24199c83993777",
"translation_date": "2026-01-08T14:19:16+00:00",
"source_file": "6-space-game/1-introduction/README.md",
"language_code": "pcm"
}
-->
# Build a Space Game Part 1: Introduction
```mermaid
journey
title Your Game Development Journey
section Foundation
Learn game architecture: 3: Student
Understand inheritance: 4: Student
Explore composition: 4: Student
section Communication
Build pub/sub system: 4: Student
Design event flow: 5: Student
Connect components: 5: Student
section Application
Create game objects: 5: Student
Implement patterns: 5: Student
Plan game structure: 5: Student
```
![Space game animation showing gameplay](../../../../6-space-game/images/pewpew.gif)
Just like NASA's mission control dey coordinate plenty systems during space launch, we go build space game wey go show how different parts of program fit work together well well. While you dey create sometin wey you fit really play, you go learn important programming concepts wey fit apply to any software project.
We go explore two important ways to organize code: inheritance and composition. Dem no be just school concepts na these patterns dey power everything from video games to banking systems. We go also implement communication system wey dem dey call pub/sub wey dey work like the communication networks wey spacecrafts dey use, wey go allow different components sabi share info without them con create dependencies.
By di end of dis series, you go understand how to build applications wey fit scale and evolve whether you dey develop games, web applications, or any oda software system.
```mermaid
mindmap
root((Game Architecture))
Object Organization
Inheritance
Composition
Class Hierarchies
Behavior Mixing
Communication Patterns
Pub/Sub System
Event Emitters
Message Passing
Loose Coupling
Game Objects
Properties (x, y)
Behaviors (move, collide)
Lifecycle Management
State Management
Design Patterns
Factory Functions
Observer Pattern
Component System
Event-Driven Architecture
Scalability
Modular Design
Maintainable Code
Testing Strategies
Performance Optimization
```
## Pre-Lecture Quiz
[Pre-lecture quiz](https://ff-quizzes.netlify.app/web/quiz/29)
## Inheritance and Composition in Game Development
As projects dey grow complex, code organization go dey very important. Wetin start as simple script fit hard to maintain without proper structure e be like how Apollo missions need serious coordination between thousands of components.
We go explore two main ways to organize code: inheritance and composition. Each one get im own advantage, and to sabi both go help you choose the best way for different situations. We go show these concepts inside our space game, where heroes, enemies, power-ups, and other objects must dey interact well.
✅ One of di most famous programming books ever written na about [design patterns](https://en.wikipedia.org/wiki/Design_Patterns).
For any game, you get `game objects` na the interactive things wey full your game world. Heroes, enemies, power-ups, and visual effects na all game objects. Each one dey exist for certain screen coordinates using `x` and `y` values, like to plot points for coordinate plane.
Even though dem different for how dem look, these objects dey share important behaviors:
- **Dem dey exist somewhere** Every object get x and y coordinates so game go sabi where to draw am
- **Plenty fit move around** Heroes dey run, enemies dey chase, bullets dey fly pass screen
- **Dem get lifespan** Some go stay dey forever, others (like explosion) go show small and disappear
- **Dem dey react to tinz** When tins collide, power-ups go get collect, health bars go change
✅ Think about game like Pac-Man. You fit identify the four object types wey we list for dis game?
```mermaid
classDiagram
class GameObject {
+x: number
+y: number
+type: string
+exists_somewhere()
}
class MovableObject {
+moveTo(x, y)
+fit_move_around()
}
class TemporaryObject {
+lifespan: number
+get_lifespan()
}
class InteractiveObject {
+onCollision()
+react_to_tings()
}
GameObject <|-- MovableObject
GameObject <|-- TemporaryObject
GameObject <|-- InteractiveObject
MovableObject <|-- Hero
MovableObject <|-- Enemy
MovableObject <|-- Bullet
TemporaryObject <|-- PowerUp
TemporaryObject <|-- Explosion
InteractiveObject <|-- Collectible
InteractiveObject <|-- Obstacle
```
### Expressing Behavior Through Code
Now wey you don understand the common behaviors wey game objects get, make we explore how to implement these behaviors for JavaScript. You fit express object behavior through methods wey dem attach to either classes or individual objects, and plenty ways dey.
**The Class-Based Approach**
Classes and inheritance dey give structured approach to organize game objects. Like the way taxonomic classification system wey Carl Linnaeus make, you go start with base class wey get common properties, then create special classes wey go inherit these basics but add specific capabilities.
✅ Inheritance na important concept to sabi. Learn more for [MDN's article about inheritance](https://developer.mozilla.org/docs/Web/JavaScript/Inheritance_and_the_prototype_chain).
See how you fit implement game objects using classes and inheritance:
```javascript
// Step 1: Mak di base GameObject klaas
class GameObject {
constructor(x, y, type) {
this.x = x;
this.y = y;
this.type = type;
}
}
```
**Make we break am down step by step:**
- We dey create basic template wey every game object fit use
- The constructor dey save where the object dey (`x`, `y`) and wetin kind thing e be
- This one go be the foundation wey all your game objects go build on
```javascript
// Step 2: Make am fit move by inherit from oda class
class Movable extends GameObject {
constructor(x, y, type) {
super(x, y, type); // Call di parent constructor
}
// Add di power to move go new position
moveTo(x, y) {
this.x = x;
this.y = y;
}
}
```
**For the one wey dey above, we:**
- **Extend** the GameObject class to add movement functionality
- **Call** the parent constructor using `super()` to initialize inherited properties
- **Add** `moveTo()` method wey dey update the object's position
```javascript
// Step 3: Mak sure say you create game object types wey get special kind
class Hero extends Movable {
constructor(x, y) {
super(x, y, 'Hero'); // Auto set the type
}
}
class Tree extends GameObject {
constructor(x, y) {
super(x, y, 'Tree'); // Trees no need to waka
}
}
// Step 4: Use your game objects
const hero = new Hero(0, 0);
hero.moveTo(5, 5); // Hero fit waka!
const tree = new Tree(10, 15);
// tree.moveTo() go cause error - trees no fit waka
```
**To understand these concepts:**
- **Create** special object types wey go inherit correct behaviors
- **Show** how inheritance fit allow make you select wetin feature you want
- **Teach** say heroes fit move but trees no fit move
- **Make clear** how class hierarchy fit stop wrong actions
✅ Take small time reminisce Pac-Man hero (Inky, Pinky or Blinky, for example) and how you fit write am in JavaScript.
**The Composition Approach**
Composition dey follow modular design philosophy, like how engineers dey design spacecraft with interchangeable parts. Instead of inherit from one parent class, you join specific behaviors to make objects wey get exactly the function wey dem need. This approach get flexibility without stiff hierarchical wahala.
```javascript
// Step 1: Make di base behavior objects
const gameObject = {
x: 0,
y: 0,
type: ''
};
const movable = {
moveTo(x, y) {
this.x = x;
this.y = y;
}
};
```
**Dis code dey do:**
- **Define** base `gameObject` wey get position and type properties
- **Create** separate `movable` behavior object with movement function
- **Separate** concerns by keeping position data and movement logic different
```javascript
// Step 2: Combine tins dem make object dem
const movableObject = { ...gameObject, ...movable };
// Step 3: Build factory function dem for different kinds object
function createHero(x, y) {
return {
...movableObject,
x,
y,
type: 'Hero'
};
}
function createStatic(x, y, type) {
return {
...gameObject,
x,
y,
type
};
}
```
**For the one wey dey above, we:**
- **Combine** base object properties with movement behavior using spread syntax
- **Make** factory functions wey go return customized objects
- **Allow** flexible object creation without stiff class hierarchy
- **Make** objects get exactly the behaviors dem need
```javascript
// Step 4: Make and use your join objects dem
const hero = createHero(10, 10);
hero.moveTo(5, 5); // E dey work well well!
const tree = createStatic(0, 0, 'Tree');
// tree.moveTo() no get - movement behavior no join together
```
**Main points to remember:**
- **Compose** objects by mixing behaviors instead of inherit them
- **Give** more flexibility pass strict inheritance hierarchies
- **Allow** objects get exactly the features dem need
- **Use** modern JavaScript spread syntax for clean object combination
```
**Which Pattern Should You Choose?**
**Which Pattern Should You Choose?**
```mermaid
quadrantChart
title Code Organization Patterns
x-axis Simple --> Complex
y-axis Rigid --> Flexible
quadrant-1 Advanced Composition
quadrant-2 Hybrid Approaches
quadrant-3 Basic Inheritance
quadrant-4 Modern Composition
Class Inheritance: [0.3, 0.2]
Interface Implementation: [0.6, 0.4]
Mixin Patterns: [0.7, 0.7]
Pure Composition: [0.8, 0.9]
Factory Functions: [0.5, 0.8]
Prototype Chain: [0.4, 0.3]
```
> 💡 **Pro Tip**: Both patterns get dia place for modern JavaScript development. Classes dey work well for clear hierarchy, while composition dey shine when you want maximum flexibility.
>
**When to use each approach:**
- **Choose** inheritance when you get clear "is-a" relationships (Hero *is-a* Movable object)
- **Select** composition when you need "has-a" relationships (Hero *get* movement ability)
- **Think about** your team preference and project needs
- **Remember** say you fit mix both approaches inside the same app
### 🔄 **Pedagogical Check-in**
**Object Organization Understanding**: Before you move to communication patterns, make sure say you fit:
- ✅ Explain the difference between inheritance and composition
- ✅ Identify when you go use classes vs factory functions
- ✅ Understand how `super()` keyword work for inheritance
- ✅ Know the benefits of each approach for game development
**Quick Self-Test**: How you go create Flying Enemy wey fit both move and fly?
- **Inheritance approach**: `class FlyingEnemy extends Movable`
- **Composition approach**: `{ ...movable, ...flyable, ...gameObject }`
**Real-World Connection**: These patterns dey everywhere:
- **React Components**: Props (composition) vs class inheritance
- **Game Engines**: Entity-component systems dey use composition
- **Mobile Apps**: UI frameworks dey use inheritance hierarchies too
## Communication Patterns: The Pub/Sub System
As applications get complex, to manage communication between components fit hard. The publish-subscribe pattern (pub/sub) dey solve this by using principles like radio broadcasting one transmitter fit reach many receivers even if e no sabi who dey listen.
Think about wetin dey happen when hero suffer damage: health bar go update, sound effect go play, visual feedback go show. Instead to join the hero object directly with these systems, pub/sub allow the hero to broadcast message "damage taken." Any system wey need respond fit subscribe to this message type and react.
**Pub/Sub** mean 'publish-subscribe'
```mermaid
flowchart TD
A[Hero Dey Take Damage] --> B[Publish: HERO_DAMAGED]
B --> C[Event System]
C --> D[Health Bar Subscriber]
C --> E[Sound System Subscriber]
C --> F[Visual Effects Subscriber]
C --> G[Achievement System Subscriber]
D --> H[Update Health Display]
E --> I[Play Damage Sound]
F --> J[Show Red Flash]
G --> K[Check Survival Achievements]
style A fill:#ffebee
style B fill:#e1f5fe
style C fill:#e8f5e8
style H fill:#fff3e0
style I fill:#fff3e0
style J fill:#fff3e0
style K fill:#fff3e0
```
### Understanding the Pub/Sub Architecture
The pub/sub pattern make different parts of your app loosely coupled, meaning say dem fit work together without direct dependence. This separation make your code easy to maintain, test and flexible to change.
**Main players for pub/sub:**
- **Messages** Simple text tags like `'PLAYER_SCORED'` wey go explain wetin happen (plus any extra info)
- **Publishers** The objects wey dey shout "Somtin happen!" to anyone wey dey listen
- **Subscribers** The objects wey talk "I care about dis event" and respond when e happen
- **Event System** Di middleman wey make sure messages reach the correct listeners
### Building an Event System
Make we create simple but powerful event system wey go show these concepts:
```javascript
// Step 1: Make di EventEmitter class
class EventEmitter {
constructor() {
this.listeners = {}; // Keep all di event listeners dem
}
// Register one listener for one kain message type
on(message, listener) {
if (!this.listeners[message]) {
this.listeners[message] = [];
}
this.listeners[message].push(listener);
}
// Send message go all di registered listeners dem
emit(message, payload = null) {
if (this.listeners[message]) {
this.listeners[message].forEach(listener => {
listener(message, payload);
});
}
}
}
```
**Break down wetin dey happen here:**
- **Create** central event management system using simple class
- **Store** listeners inside object organized by message type
- **Register** new listeners using `on()` method
- **Broadcast** messages to all listeners wey dey interested using `emit()`
- **Support** optional data to carry relevant info
### Putting It All Together: A Practical Example
Alright, make we see am for real! We go build simple movement system wey go show how simple and flexible pub/sub fit be:
```javascript
// Step 1: Tok say wetin kin message you wan use
const Messages = {
HERO_MOVE_LEFT: 'HERO_MOVE_LEFT',
HERO_MOVE_RIGHT: 'HERO_MOVE_RIGHT',
ENEMY_SPOTTED: 'ENEMY_SPOTTED'
};
// Step 2: Make your event system and game tins
const eventEmitter = new EventEmitter();
const hero = createHero(0, 0);
```
**Dis code dey do:**
- **Define** constants object to prevent typo for message names
- **Create** event emitter instance to handle all communication
- **Initialize** hero object for starting position
```javascript
// Step 3: Arrange for event listeners (people wey dey subscribe)
eventEmitter.on(Messages.HERO_MOVE_LEFT, () => {
hero.moveTo(hero.x - 5, hero.y);
console.log(`Hero moved to position: ${hero.x}, ${hero.y}`);
});
eventEmitter.on(Messages.HERO_MOVE_RIGHT, () => {
hero.moveTo(hero.x + 5, hero.y);
console.log(`Hero moved to position: ${hero.x}, ${hero.y}`);
});
```
**For the one wey dey above, we:**
- **Register** event listeners wey respond to movement messages
- **Update** hero position based on movement direction
- **Add** console logging to track hero position change
- **Separate** movement logic from input handling
```javascript
// Step 4: Make keyboard input join events (publishers)
window.addEventListener('keydown', (event) => {
switch(event.key) {
case 'ArrowLeft':
eventEmitter.emit(Messages.HERO_MOVE_LEFT);
break;
case 'ArrowRight':
eventEmitter.emit(Messages.HERO_MOVE_RIGHT);
break;
}
});
```
**To understand these concepts:**
- **Connect** keyboard input to game events without strong coupling
- **Make** input system fit talk to game objects indirectly
- **Allow** many systems respond to same keyboard events
- **Make** e easy to change key bindings or add new input ways
```mermaid
sequenceDiagram
participant User
participant Keyboard
participant EventEmitter
participant Hero
participant SoundSystem
participant Camera
User->>Keyboard: Press ArrowLeft
Keyboard->>EventEmitter: emit('HERO_MOVE_LEFT')
EventEmitter->>Hero: Move left 5 pixels
EventEmitter->>SoundSystem: Play footstep sound
EventEmitter->>Camera: Follow hero
Hero->>Hero: Update position
SoundSystem->>SoundSystem: Play audio
Camera->>Camera: Adjust viewport
```
> 💡 **Pro Tip**: The beauty of this pattern na flexibility! You fit add sound effects, screen shake, or particle effects by just adding more listeners no need change keyboard or movement code.
>
**Why you go love this approach:**
- Adding new features go easy just listen for events you care about
- Many tinz fit react to same event without conflict
- Testing go simple because every piece dey independent
- When somtin break, you sabi exactly where to check
### Why Pub/Sub Scales Effectively
The pub/sub pattern dey keep things simple as applications dey get big. Whether you dey manage plenty enemies, dynamic UI updates, or sound systems, the pattern fit handle scale without architecture wahala. New features go join inside existing event system without affect older functionality.
> ⚠️ **Common Mistake**: No make too many specific message types early. Start with big categories and sharpen as your game need clear.
>
**Best practices:**
- **Group** related messages into logical categories
- **Use** clear names wey show wetin happen
- **Keep** message payloads simple and focused
- **Document** your message types for team work
### 🔄 **Pedagogical Check-in**
**Event-Driven Architecture Understanding**: Check if you sabi the whole system:
- ✅ How pub/sub pattern dey prevent strong coupling between components?
- ✅ Why e dey easy to add new features with event-driven architecture?
- ✅ Wetin the EventEmitter dey do for communication flow?
- ✅ How message constants dey prevent bugs and make maintainability better?
**Design Challenge**: How you go handle these game cases with pub/sub?
1. **Enemy dies**: Update score, play sound, spawn power-up, remove from screen
2. **Level complete**: Stop music, show UI, save progress, load next level
3. **Power-up collected**: Enhance abilities, update UI, play effect, start timer
**Professional Connection**: This pattern dey for:
- **Frontend Frameworks**: React/Vue event systems
- **Backend Services**: Microservice communication
- **Game Engines**: Unity event systems
- **Mobile Development**: iOS/Android notification systems
---
## GitHub Copilot Agent Challenge 🚀
Use the Agent mode to complete this challenge:
**Description:** Create simple game object system using both inheritance and pub/sub pattern. You go implement basic game where different objects fit communicate through events without directly knowing about each other.
**Prompt:** Create JavaScript game system wey get these requirements: 1) Create base GameObject class with x, y coordinates and type property. 2) Create Hero class wey extend GameObject and fit move. 3) Create Enemy class wey extend GameObject and fit chase the hero. 4) Implement EventEmitter class for pub/sub pattern. 5) Setup event listeners so when hero move, nearby enemies receive 'HERO_MOVED' event and update their position to move toward hero. Include console.log to show communication between objects.
Learn more about [agent mode](https://code.visualstudio.com/blogs/2025/02/24/introducing-copilot-agent-mode) here.
## 🚀 Challenge
Consider how the pub-sub pattern fit better game architecture. Identify which components suppose dey emit events and how the system suppose respond. Design one game concept and map out di communication patterns between im components.
## Post-Lecture Quiz
[Post-lecture quiz](https://ff-quizzes.netlify.app/web/quiz/30)
## Review & Self Study
Learn more about Pub/Sub by [reading about am](https://docs.microsoft.com/azure/architecture/patterns/publisher-subscriber/?WT.mc_id=academic-77807-sagibbon).
### ⚡ **Wetin You Fit Do for Di Next 5 Minutes**
- [ ] Open any HTML5 game online and check im code using DevTools
- [ ] Create one simple HTML5 Canvas element and draw one basic shape
- [ ] Try use `setInterval` create one simple animation loop
- [ ] Explore di Canvas API documentation and try one drawing method
### 🎯 **Wetin You Fit Achieve This Hour**
- [ ] Complete di post-lesson quiz and understand game development concepts
- [ ] Set up your game project structure with HTML, CSS, and JavaScript files
- [ ] Create one basic game loop wey dey update and render continuously
- [ ] Draw your first game sprites for di canvas
- [ ] Implement basic asset loading for images and sounds
### 📅 **Your Week-Long Game Creation**
- [ ] Complete di full space game with all di planned features
- [ ] Add polished graphics, sound effects, and smooth animations
- [ ] Implement game states (start screen, gameplay, game over)
- [ ] Create scoring system and player progress tracking
- [ ] Make your game responsive and accessible across devices
- [ ] Share your game online and gather feedback from players
### 🌟 **Your Month-Long Game Development**
- [ ] Build multiple games wey explore different genres and mechanics
- [ ] Learn game development framework like Phaser or Three.js
- [ ] Contribute to open source game development projects
- [ ] Master advanced game programming patterns and optimization
- [ ] Create portfolio wey show your game development skills
- [ ] Mentor others wey dey interested for game development and interactive media
## 🎯 Your Game Development Mastery Timeline
```mermaid
timeline
title Game Architecture Learning Progression
section Object Patterns (20 minutes)
Code Organization: Class inheritance
: Composition patterns
: Factory functions
: Behavior mixing
section Communication Systems (25 minutes)
Event Architecture: Pub/Sub implementation
: Message design
: Event emitters
: Loose coupling
section Game Object Design (30 minutes)
Entity Systems: Property management
: Behavior composition
: State handling
: Lifecycle management
section Architecture Patterns (35 minutes)
System Design: Component systems
: Observer pattern
: Command pattern
: State machines
section Advanced Concepts (45 minutes)
Scalable Architecture: Performance optimization
: Memory management
: Modular design
: Testing strategies
section Game Engine Concepts (1 week)
Professional Development: Scene graphs
: Asset management
: Rendering pipelines
: Physics integration
section Framework Mastery (2 weeks)
Modern Game Development: React game patterns
: Canvas optimization
: WebGL basics
: PWA games
section Industry Practices (1 month)
Professional Skills: Team collaboration
: Code reviews
: Game design patterns
: Performance profiling
```
### 🛠️ Your Game Architecture Toolkit Summary
After you finish dis lesson, you get now:
- **Design Pattern Mastery**: Understand inheritance vs composition trade-offs
- **Event-Driven Architecture**: Pub/sub implementation for scalable communication
- **Object-Oriented Design**: Class hierarchies and behavior composition
- **Modern JavaScript**: Factory functions, spread syntax, and ES6+ patterns
- **Scalable Architecture**: Loose coupling and modular design principles
- **Game Development Foundation**: Entity systems and component patterns
- **Professional Patterns**: Industry-standard ways to arrange code
**Real-World Applications**: These patterns fit come:
- **Frontend Frameworks**: React/Vue component architecture and state management
- **Backend Services**: Microservice communication and event-driven systems
- **Mobile Development**: iOS/Android app architecture and notification systems
- **Game Engines**: Unity, Unreal, and web-based game development
- **Enterprise Software**: Event sourcing and distributed system design
- **API Design**: RESTful services and real-time communication
**Professional Skills Gained**: You fit now:
- **Design** scalable software architectures using proven patterns
- **Implement** event-driven systems wey handle complex interactions
- **Choose** better code organization strategies for different scenarios
- **Debug** and maintain loosely coupled systems well well
- **Communicate** technical decisions using industry-standard language
**Next Level**: You ready to implement these patterns for real game, explore advanced game development topics, or apply these architectural knowledge to web apps!
🌟 **Achievement Unlocked**: You don master important software architecture patterns wey dey power everything from simple games to complex enterprise systems!
## Assignment
[Mock up a game](assignment.md)
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document na translate wey AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator) do. Even tho we dey try make everything correct, abeg sabi say automatic translation fit get some mistakes or no correct well. The original document wey dem write for im own language na the real correct one to trust. For important matter, e good make professional human translation help. We no go responsible if anybody misunderstand or mix things up because of this translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,102 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "c8fc39a014d08247c082878122e2ba73",
"translation_date": "2026-01-08T14:28:32+00:00",
"source_file": "6-space-game/1-introduction/assignment.md",
"language_code": "pcm"
}
-->
# Mock up a Game: Apply Design Patterns
## Assignment Overview
Put your newfound knowledge of design patterns to work by creating a simple game prototype! Dis assignment go help you practice both architectural patterns (inheritance or composition) and di pub/sub communication system wey you learn for di lesson.
## Instructions
Create one simple game representation wey go show di design patterns from dis lesson. Your game suppose dey functional but e no need get complex graphics focus on di underlying architecture and communication patterns.
### Requirements
**Choose Your Architecture Pattern:**
- **Option A**: Use class-based inheritance (like the `GameObject``Movable``Hero` example)
- **Option B**: Use composition (like the factory function approach wey get mixed behaviors)
**Implement Communication:**
- **Include** one `EventEmitter` class for pub/sub messaging
- **Set up** at least 2-3 different message types (like `PLAYER_MOVE`, `ENEMY_SPAWN`, `SCORE_UPDATE`)
- **Connect** user input (keyboard/mouse) to game events through di event system
**Game Elements to Include:**
- At least one player-controlled character
- At least one other game object (enemy, collectible, or environmental element)
- Basic interaction between objects (collision, collection, or communication)
### Suggested Game Ideas
**Simple Games to Consider:**
- **Snake Game** Snake segments dey follow head, food dey spawn randomly
- **Pong Variation** Paddle dey respond to input, ball dey bounce off walls
- **Collector Game** Player dey move around dey collect items while dem dey avoid obstacles
- **Tower Defense Basics** Towers dey detect and shoot at moving enemies
### Code Structure Guidelines
```javascript
// Example wey dem start with
const Messages = {
// Put your game messages here
};
class EventEmitter {
// How you go take do your event system
}
// Choose whether na class-based OR composition method
// Class-based example:
class GameObject { /* base properties */ }
class Player extends GameObject { /* player-specific behavior */ }
// OR Composition example:
const gameObject = { /* base properties */ };
const movable = { /* movement behavior */ };
function createPlayer() { /* combine behaviors */ }
```
### Testing Your Implementation
**Verify say your code dey work by:**
- **Testing** say objects dey move or change when events trigger
- **Confirming** say plenty objects fit respond to di same event
- **Checking** say you fit add new behaviors without changing old code
- **Ensuring** keyboard/mouse input dey properly trigger game events
## Submission Guidelines
**Your submission suppose include:**
1. **JavaScript file(s)** wey get your game implementation
2. **HTML file** to run and test your game (fit simple)
3. **Comments** wey explain which pattern you choose and why
4. **Brief documentation** of your message types and wetin dem do
## Rubric
| Criteria | Exemplary (3 points) | Adequate (2 points) | Needs Improvement (1 point) |
|----------|---------------------|---------------------|------------------------------|
| **Architecture Pattern** | Correctly dey implement inheritance OR composition with clear class/object hierarchy | Uses chosen pattern with small wahala or inconsistencies | Try use pattern but implementation get big wahala |
| **Pub/Sub Implementation** | EventEmitter dey work well with many message types and correct event flow | Basic pub/sub system dey work with small event handling | Event system dey but e no dey work steady |
| **Game Functionality** | Three or more interactive elements wey dey communicate through events | Two interactive elements with basic event communication | One element dey respond to events or basic interaction |
| **Code Quality** | Clean, well-commented code with logical arrangement and modern JavaScript | Generally well-organized code with enough comments | Code dey work but e no organized or no clear commenting |
**Bonus Points:**
- **Creative game mechanics** wey show interesting use of di patterns
- **Multiple input methods** (keyboard AND mouse events)
- **Scalable architecture** wey go easy to add new features
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis dokument na AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator) we translate am. Even though we try make am correct, abeg sabi say automatic translation fit get mistake or no correct finish. Di original dokument wey dey im ogbonge language na di correct one. If na serious mata, e better make person use professional human translation. We no go take responsibility if person no understand well or mistake am because of this translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,624 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "7994743c5b21fdcceb36307916ef249a",
"translation_date": "2026-01-08T13:37:36+00:00",
"source_file": "6-space-game/2-drawing-to-canvas/README.md",
"language_code": "pcm"
}
-->
# Build a Space Game Part 2: Draw Hero and Monsters to Canvas
```mermaid
journey
title Your Canvas Graphics Journey
section Foundation
Understand Canvas API: 3: Student
Learn coordinate system: 4: Student
Draw basic shapes: 4: Student
section Image Handling
Load game assets: 4: Student
Handle async loading: 5: Student
Position sprites: 5: Student
section Game Rendering
Create game screen: 5: Student
Build formations: 5: Student
Optimize performance: 4: Student
```
Di Canvas API na one of di web development powerfull tin dem wey fit create dynamic, interactive graphics direct for your browser. For dis lesson, we go change dat blank HTML `<canvas>` element come be game world wey full with heroes and monsters. Think am like your digital art board wey code dey change to visual.
We dey build on top wetin you learn for di last lesson, and now we go enter di visual tins dem. You go learn how to load and show game sprites, put elements for correct position, and create di visual base for your space game. Dis one go join di gap between static web pages and dynamic, interactive experience dem.
By di time we don finish dis lesson, you go get complete game scene wey your hero ship dey positioned well and enemy formations dey ready for battle. You go sabi how modern games dey render graphics for browsers and gain skills to create your own interactive visual experiences. Make we explore canvas graphics and bring your space game come life!
```mermaid
mindmap
root((Canvas Graphics))
Canvas Element
HTML5 Feature
2D Context
Coordinate System
Pixel Control
Drawing Operations
Basic Shapes
Text Rendering
Image Display
Path Drawing
Asset Management
Image Loading
Async Operations
Error Handling
Performance
Game Rendering
Sprite Positioning
Formation Layout
Scene Composition
Frame Updates
Visual Effects
Colors & Styles
Transformations
Animations
Layering
```
## Pre-Lecture Quiz
[Pre-lecture quiz](https://ff-quizzes.netlify.app/web/quiz/31)
## The Canvas
So wetin dis `<canvas>` element really be? Na HTML5 solution for creating dynamic graphics and animations inside web browsers. E different from regular images or videos wey na static, di canvas dey give you control for every pixel wey show for screen. Dis one perfect for games, data visualizations, and interactive art. Think am as programmable drawing surface wey JavaScript be your paintbrush.
By default, canvas element be like blank, transparent rectangle for your page. But na there di potential dey! E real power dey come out when you use JavaScript draw shapes, load images, create animates, and make tins respond to how user interact. E similar to how early computer graphics pipo for Bell Labs for di 1960s gats program every pixel to create di first digital animations.
✅ Read [more about the Canvas API](https://developer.mozilla.org/docs/Web/API/Canvas_API) for MDN.
Dis na how e normally dey show for page body:
```html
<canvas id="myCanvas" width="200" height="100"></canvas>
```
**Dis na wetin dis code dey do:**
- **Sets** di `id` attribute so you fit reference dis particular canvas element inside JavaScript
- **Defines** di `width` for pixels to control horizontal size of di canvas
- **Establishes** di `height` for pixels to determine vertical dimension of di canvas
## Drawing Simple Geometry
Now wey you don sabi wetin di canvas element be, mek we explore how to actually draw for am! Di canvas dey use coordinate system wey fit remind you of math class, but one important kink dey wey relate to computer graphics.
Di canvas dey use Cartesian coordinates with x-axis (horizontal) and y-axis (vertical) to place everytin wey you draw. But di main difference be say: no be like math class coordinate system, di origin point `(0,0)` dey for top-left corner, with x-values dey increase as you dey move right and y-values dey increase as you dey move down. Dis approach come from early computer displays wey electron beams dey scan from top to bottom, so top-left na di natural starting point.
```mermaid
quadrantChart
title Canvas Coordinate System
x-axis Left --> Right
y-axis Top --> Bottom
quadrant-1 Quadrant 1
quadrant-2 Quadrant 2
quadrant-3 Quadrant 3
quadrant-4 Quadrant 4
Origin Point: [0.1, 0.1]
Hero Center: [0.5, 0.8]
Enemy Formation: [0.3, 0.2]
Power-up: [0.7, 0.6]
UI Elements: [0.9, 0.1]
```
![di canvas grid](../../../../translated_images/canvas_grid.5f209da785ded492.pcm.png)
> Image from [MDN](https://developer.mozilla.org/docs/Web/API/Canvas_API/Tutorial/Drawing_shapes)
To draw for di canvas element, you go follow same three-step process wey be foundation for all canvas graphics. Once you do am small times, e go become second nature:
```mermaid
flowchart LR
A[HTML Canvas Element] --> B[Get Canvas Reference]
B --> C[Get 2D Context]
C --> D[Drawing Operations]
D --> E[Draw Shapes]
D --> F[Draw Text]
D --> G[Draw Images]
D --> H[Apply Styles]
E --> I[Render to Screen]
F --> I
G --> I
H --> I
style A fill:#e1f5fe
style C fill:#e8f5e8
style I fill:#fff3e0
```
1. **Get reference** to your Canvas element from di DOM (like any other HTML element)
2. **Get di 2D rendering context** dis one dey provide all di drawing methods
3. **Start to draw!** Use di context built-in methods to create your graphics
Dis na how e look for code:
```javascript
// Step 1: Comot di canvas element
const canvas = document.getElementById("myCanvas");
// Step 2: Comot di 2D rendering context
const ctx = canvas.getContext("2d");
// Step 3: Set di fill color an draw one rectangle
ctx.fillStyle = 'red';
ctx.fillRect(0, 0, 200, 200); // x, y, width, height
```
**Make we break dis down step by step:**
- We **grab** our canvas element by im ID and store am for variable
- We **get** di 2D rendering context na our toolkit full of drawing methods dis be
- We **tell** di canvas say we wan fill tins with red with di `fillStyle` property
- We **draw** rectangle wey dey start for top-left corner (0,0) wey 200 pixels wide and tall be dat
✅ Di Canvas API focus mostly on 2D shapes, but you fit also draw 3D tins for web site; for dis, you fit use di [WebGL API](https://developer.mozilla.org/docs/Web/API/WebGL_API).
You fit draw all kain tins with di Canvas API like:
- **Geometrical shapes**, we don show how to draw rectangle, but many more tins dey wey you fit draw.
- **Text**, you fit draw text with any font and color wey you want.
- **Images**, you fit draw image based on image asset like .jpg or .png for example.
✅ Try am! You sabi how to draw rectangle, you fit draw circle for page? Check some interesting Canvas drawings for CodePen. Here na [one example wey good well](https://codepen.io/dissimulate/pen/KrAwx).
### 🔄 **Pedagogical Check-in**
**Canvas Fundamentals Understanding**: Before you move go image loading, make sure you fit:
- ✅ Explain how di canvas coordinate system different from math coordinates
- ✅ Understand di three-step process for canvas drawing operations
- ✅ Identify wetin di 2D rendering context provide
- ✅ Describe how fillStyle and fillRect dey work together
**Quick Self-Test**: How you go draw blue circle for position (100, 50) with radius 25?
```javascript
ctx.fillStyle = 'blue';
ctx.beginPath();
ctx.arc(100, 50, 25, 0, 2 * Math.PI);
ctx.fill();
```
**Canvas Drawing Methods We You Don Know**:
- **fillRect()**: Draw filled rectangles
- **fillStyle**: Set colors and patterns
- **beginPath()**: Start new drawing paths
- **arc()**: Create circles and curves
## Load and Draw an Image Asset
Drawing simple shapes e good for start, but most games need real images! Sprites, backgrounds, and textures na wetin make games get better visual look. Loading and showing images on canvas different from drawing geometric shapes, but e easy once you sabi the way.
We gats create `Image` object, load our image file (dis one na asynchronous, e mean say e dey happen "for background"), then draw am for canvas when e ready. Dis approach make sure say your images go show well without blocking your application while dem dey load.
```mermaid
sequenceDiagram
participant JS as JavaScript
participant Img as Image Object
participant Server as File Server
participant Canvas as Canvas Context
JS->>Img: new Image()
JS->>Img: Set src property
Img->>Server: Request image file
Server->>Img: Return image data
Img->>JS: Trigger onload event
JS->>Canvas: drawImage(img, x, y)
Canvas->>Canvas: Render to screen
Note over JS,Canvas: Async loading dey stop UI from gbege
```
### Basic Image Loading
```javascript
const img = new Image();
img.src = 'path/to/my/image.png';
img.onload = () => {
// Image don load and e ready to use
console.log('Image loaded successfully!');
};
```
**Dis na wetin dey happen for dis code:**
- We **create** new Image object to hold our sprite or texture
- We **tell** am which image file to load by setting source path
- We **listen** for load event so we go know exact time wey image ready to use
### Better Way to Load Images
Here na better way to handle image loading wey professional developers dey usually use. We go wrap di image loading with Promise-based function dis approach wey JavaScript Promises popular in ES6, go organize your code well and handle errors sharp-sharp:
```javascript
function loadAsset(path) {
return new Promise((resolve, reject) => {
const img = new Image();
img.src = path;
img.onload = () => {
resolve(img);
};
img.onerror = () => {
reject(new Error(`Failed to load image: ${path}`));
};
});
}
// Modern way to use am wit async/await
async function initializeGame() {
try {
const heroImg = await loadAsset('hero.png');
const monsterImg = await loadAsset('monster.png');
// Images dem don ready to use now
} catch (error) {
console.error('Failed to load game assets:', error);
}
}
```
**Wetin we do here:**
- **Wrap** all di image loading logic inside Promise so e go better handle am
- **Add** error handling wey go really tell us if any tin go wrong
- **Use** modern async/await syntax because e clear and easy to read
- **Include** try/catch blocks to handle loading wahala well
Once your images load finish, drawing dem for canvas na easy matter:
```javascript
async function renderGameScreen() {
try {
// Load game things dem
const heroImg = await loadAsset('hero.png');
const monsterImg = await loadAsset('monster.png');
// Find canvas and context
const canvas = document.getElementById("myCanvas");
const ctx = canvas.getContext("2d");
// Draw picture dem for specific place dem
ctx.drawImage(heroImg, canvas.width / 2, canvas.height / 2);
ctx.drawImage(monsterImg, 0, 0);
} catch (error) {
console.error('Failed to render game screen:', error);
}
}
```
**Make we run dis step by step:**
- We **load** both our hero and monster images for background using await
- We **grab** our canvas element and get di 2D rendering context we need
- We **position** hero image for center using some quick coordinate math
- We **put** monster image for top-left corner to start our enemy formation
- We **catch** any errors wey fit happen during loading or rendering
```mermaid
flowchart TD
A[Load Assets] --> B{All Images Loaded?}
B -->|No| C[Show Loading]
B -->|Yes| D[Get Canvas Context]
C --> B
D --> E[Clear Screen]
E --> F[Draw Background]
F --> G[Draw Enemy Formation]
G --> H[Draw Hero Ship]
H --> I[Apply Visual Effects]
I --> J[Render Frame]
subgraph "Rendering Pipeline"
K[Asset Management]
L[Scene Composition]
M[Drawing Operations]
N[Frame Output]
end
style A fill:#e1f5fe
style J fill:#e8f5e8
style I fill:#fff3e0
```
## Now E Time to Start Building Your Game
Now we go join everytin together to create di visual base for your space game. You get solid understanding of canvas fundamentals and image loading, so dis hands-on section go guide you build complete game screen with proper sprite position.
### Wetin To Build
You go build web page wey get Canvas element. E suppose show black screen `1024*768`. We don provide you with two images:
- Hero ship
![Hero ship](../../../../translated_images/player.dd24c1afa8c71e9b.pcm.png)
- 5*5 monster
![Monster ship](../../../../translated_images/enemyShip.5df2a822c16650c2.pcm.png)
### Recommended steps to start development
Find di starter files wey dem don create for you for `your-work` sub folder. Your project structure suppose get:
```bash
your-work/
├── assets/
│ ├── enemyShip.png
│ └── player.png
├── index.html
├── app.js
└── package.json
```
**Dis na wetin you dey work with:**
- **Game sprites** dey `assets/` folder so everything go stay organized
- **Your main HTML file** go setup canvas element and prepare everything
- **JavaScript file** wey you go write all your game rendering magic
- **A package.json** wey go setup development server so you fit test locally
Open dis folder for Visual Studio Code to start development. You need local development environment with Visual Studio Code, NPM, and Node.js installed. If you never get `npm` for your computer, [here na how to install am](https://www.npmjs.com/get-npm).
Start your development server by entering `your-work` folder:
```bash
cd your-work
npm start
```
**Dis command dey do cool tins:**
- **Start** local server for `http://localhost:5000` so you fit test game
- **Serve** all your files correct make your browser fit load am well
- **Watch** your files for changes so you fit develop smoothly
- **Give you** professional development environment for testing everything
> 💡 **Note**: At first your browser go show blank page na normal! As you add code, just refresh browser to see your changes. Dis iterative development approach similar to how NASA build Apollo guidance computer dem dey test each part before dem join am together.
### Add code
Add di code wey dem ask for inside `your-work/app.js` to finish dis tasks:
1. **Draw canvas wit black background**
> 💡 **How e go be**: Find TODO inside `/app.js` and add only two lines. Set `ctx.fillStyle` to black, then use `ctx.fillRect()` start (0,0) with your canvas size. Easy!
2. **Load game textures**
> 💡 **How e go be**: Use `await loadAsset()` to load your player and enemy images. Store dem for variables so you fit use later. Remember dem no go show till you draw dem!
3. **Draw hero ship for center-bottom position**
> 💡 **How e go be**: Use `ctx.drawImage()` to position your hero. For x-coordinate, try `canvas.width / 2 - 45` to center am, for y-coordinate use `canvas.height - canvas.height / 4` put am for bottom area.
4. **Draw 5×5 formation of enemy ships**
> 💡 **How e go be**: Find `createEnemies` function and set nested loop. You need do some math for space and position, but no worry I go show you exactly how!
First, set constants for correct enemy formation layout:
```javascript
const ENEMY_TOTAL = 5;
const ENEMY_SPACING = 98;
const FORMATION_WIDTH = ENEMY_TOTAL * ENEMY_SPACING;
const START_X = (canvas.width - FORMATION_WIDTH) / 2;
const STOP_X = START_X + FORMATION_WIDTH;
```
**Make we break down weh dis constants dey do:**
- We **set** 5 enemies per row and column (nice 5×5 grid)
- We **define** how far enemies go dey from each other so dem no go too close
- We **calculate** di width of our whole formation
- We **figure** where to start and stop so formation go look centered
```mermaid
flowchart LR
A["Canvas Width: 1024px"] --> B["Formation Width: 490px"]
B --> C["Start X: 267px"]
C --> D["Enemy Spacing: 98px"]
subgraph "5x5 Enemy Formation"
E["Row 1: Y=0"]
F["Row 2: Y=50"]
G["Row 3: Y=100"]
H["Row 4: Y=150"]
I["Row 5: Y=200"]
end
subgraph "Column Spacing"
J["Col 1: X=267"]
K["Col 2: X=365"]
L["Col 3: X=463"]
M["Col 4: X=561"]
N["Col 5: X=659"]
end
style A fill:#e1f5fe
style B fill:#e8f5e8
style C fill:#fff3e0
```
Then, create nested loops to draw enemy formation:
```javascript
for (let x = START_X; x < STOP_X; x += ENEMY_SPACING) {
for (let y = 0; y < 50 * 5; y += 50) {
ctx.drawImage(enemyImg, x, y);
}
}
```
**Dis na wetin dis nested loop dey do:**
- Outer loop **go move** left to right across formation
- Inner loop **go move** top to bottom to create nice rows
- We **draw** each enemy sprite for exact x,y coordinates we calculate
- Everything **stay evenly spaced** so e go look sharp and organized
### 🔄 **Pedagogical Check-in**
**Game Rendering Mastery**: Make sure you understand whole rendering system:
- ✅ How async image loading dey stop UI from blocking for game start?
- ✅ Why we dey calculate enemy formation position with constants, no hardcode?
- ✅ Wetin 2D rendering context dey do for drawing?
- ✅ How nested loops dey create organized sprite formations?
**Performance Considerations**: Your game now dey show:
- **Efficient asset loading**: Promise-based image management
- **Organized rendering**: Structured drawing operations
- **Mathematical positioning**: Calculated sprite placement
- **Error handling**: Graceful failure management
**Visual Programming Concepts**: You don learn:
- **Coordinate systems**: Di way we take change math go screen positions
- **Sprite management**: How to load an show game graphics
- **Formation algorithms**: Math patterns for organized layouts
- **Async operations**: Modern JavaScript for better user experience
## Result
Di final result suppose be like dis:
![Black screen with a hero and 5*5 monsters](../../../../translated_images/partI-solution.36c53b48c9ffae2a.pcm.png)
## Solution
Try solve am by yourself first but if you jam, make you check dis [solution](../../../../6-space-game/2-drawing-to-canvas/solution/app.js)
---
## GitHub Copilot Agent Challenge 🚀
Use di Agent mode to complete dis challenge:
**Description:** Make your space game canvas beta by adding visual effects and interactive tins using di Canvas API way you don learn.
**Prompt:** Create new file wey dem go call `enhanced-canvas.html` wey get canvas wey dey show animated stars for background, one pulsing health bar for di hero ship, plus enemy ships wey go dey slowly move down. Add JavaScript code wey go draw twinkling stars using random positions and opacity, put health bar wey dey change color base on health level (green > yellow > red), plus make di enemy ships dey move down di screen with different speeds.
Learn more about [agent mode](https://code.visualstudio.com/blogs/2025/02/24/introducing-copilot-agent-mode) here.
## 🚀 Challenge
You don sabi how to draw with di 2D Canvas API; try check am for [WebGL API](https://developer.mozilla.org/docs/Web/API/WebGL_API), then try draw 3D object.
## Post-Lecture Quiz
[Post-lecture quiz](https://ff-quizzes.netlify.app/web/quiz/32)
## Review & Self Study
Learn more about di Canvas API by [reading about it](https://developer.mozilla.org/docs/Web/API/Canvas_API).
### ⚡ **Wetin You Fit Do For Di Next 5 Minutes**
- [ ] Open your browser console and create canvas element with `document.createElement('canvas')`
- [ ] Try draw rectangle using `fillRect()` for canvas context
- [ ] Experiment with different colors using `fillStyle` property
- [ ] Draw simple circle using `arc()` method
### 🎯 **Wetin You Fit Achieve This Hour**
- [ ] Complete post-lesson quiz and understand canvas basics
- [ ] Create canvas drawing app with plenty shapes and colors
- [ ] Implement image loading and sprite rendering for your game
- [ ] Build simple animation wey dey move objects across di canvas
- [ ] Practice canvas transformations like scaling, rotation, and translation
### 📅 **Your Week-Long Canvas Journey**
- [ ] Complete space game with polished graphics and sprite animations
- [ ] Master advanced canvas techniques like gradients, patterns, and compositing
- [ ] Create interactive visualizations using canvas for data representation
- [ ] Learn canvas optimization techniques for smooth performance
- [ ] Build drawing or painting app with different tools
- [ ] Explore creative coding patterns and generative art with canvas
### 🌟 **Your Month-Long Graphics Mastery**
- [ ] Build complex visual apps using Canvas 2D and WebGL
- [ ] Learn graphics programming concepts and shader basics
- [ ] Contribute to open source graphics libraries and visualization tools
- [ ] Master performance optimization for graphics-heavy apps
- [ ] Create educational content about canvas programming and computer graphics
- [ ] Become graphics programming expert wey fit help others create visual experience
## 🎯 Your Canvas Graphics Mastery Timeline
```mermaid
timeline
title Canvas API Learning Progression
section Canvas Fundamentals (15 minutes)
Basic Operations: Element reference
: 2D context access
: Coordinate system
: Simple shape drawing
section Drawing Techniques (20 minutes)
Graphics Primitives: Rectangles and circles
: Colors and styles
: Text rendering
: Path operations
section Image Handling (25 minutes)
Asset Management: Image object creation
: Async loading patterns
: Error handling
: Performance optimization
section Game Graphics (30 minutes)
Sprite Rendering: Positioning algorithms
: Formation calculations
: Scene composition
: Frame rendering
section Advanced Techniques (40 minutes)
Visual Effects: Transformations
: Animations
: Layering
: State management
section Performance (35 minutes)
Optimization: Efficient drawing
: Memory management
: Frame rate control
: Asset caching
section Professional Skills (1 week)
Production Graphics: WebGL integration
: Canvas libraries
: Game engines
: Cross-platform considerations
section Advanced Graphics (1 month)
Specialized Applications: Data visualization
: Interactive art
: Real-time effects
: 3D graphics
```
### 🛠️ Your Canvas Graphics Toolkit Summary
After you finish dis lesson, you get:
- **Canvas API Mastery**: Full understanding of 2D graphics programming
- **Coordinate Mathematics**: Correct positioning and layout algorithms
- **Asset Management**: Professional image loading with error handling
- **Rendering Pipeline**: Organized way to compose scenes
- **Game Graphics**: Sprite positioning and formation calculations
- **Async Programming**: Modern JavaScript patterns for smooth performance
- **Visual Programming**: How to change math concepts to screen graphics
**Real-World Applications**: Your Canvas skills fit directly apply to:
- **Data Visualization**: Charts, graphs, and interactive dashboards
- **Game Development**: 2D games, simulations, and interactive experience
- **Digital Art**: Creative coding and generative art projects
- **UI/UX Design**: Custom graphics and interactive elements
- **Educational Software**: Visual learning tools and simulations
- **Web Applications**: Dynamic graphics and real-time visuals
**Professional Skills Gained**: Now you fit:
- **Build** custom graphics wey no use outside libraries
- **Optimize** rendering performance for smooth user experience
- **Debug** complex visual wahala with browser developer tools
- **Design** scalable graphics system using math principles
- **Integrate** Canvas graphics wit modern web application frameworks
**Canvas API Methods You Don Master**:
- **Element Management**: getElementById, getContext
- **Drawing Operations**: fillRect, drawImage, fillStyle
- **Asset Loading**: Image objects, Promise patterns
- **Mathematical Positioning**: Coordinate calculations, formation algorithms
**Next Level**: You fit now add animation, user interaction, collision detection, or try WebGL for 3D graphics!
🌟 **Achievement Unlocked**: You don build complete game rendering system using basic Canvas API techniques!
## Assignment
[Play with the Canvas API](assignment.md)
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document don translate by AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator). Even though we dey try make am correct, abeg sabi say automated translations fit get some mistake or wahala. The original document wey e dey for im own language na the real correct source. For important information, e good make person wey sabi translate am well do the translation. We no go take responsibility for any misunderstanding or wrong meaning wey fit happen because of dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,83 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "87cd43afe5b69dbbffb5c4b209ea6791",
"translation_date": "2026-01-08T13:46:32+00:00",
"source_file": "6-space-game/2-drawing-to-canvas/assignment.md",
"language_code": "pcm"
}
-->
# Assignment: Explore di Canvas API
## Learning Objectives
By finishing dis assignment, you go show say you sabi Canvas API basics and fit use creative problem-solving build visual tins wit JavaScript and HTML5 canvas.
## Instructions
Choose one part of di Canvas API wey dey interest you come create one better visual project around am. Dis assignment dey encourage you to try di drawing skills wey you don learn as you build sometin wey be your own.
### Project Ideas to Inspire You
**Geometric Patterns:**
- **Create** galaxy of animated twinkling stars wey dey position randomly
- **Design** interesting texture with repeated geometric shapes
- **Build** kaleidoscope effect with patterns wey dey rotate and get plenty colour
**Interactive Elements:**
- **Develop** drawing tool wey dey respond to mouse movements
- **Implement** shapes wey go change colour when you click am
- **Design** simple animation loop wit moving elements
**Game-Related Graphics:**
- **Craft** scrolling background for space game
- **Build** particle effects like explosions or magic spells
- **Create** animated sprites with many frames
### Development Guidelines
**Research and Inspiration:**
- **Browse** CodePen for creative canvas examples (to inspire you, no to copy)
- **Study** di [Canvas API documentation](https://developer.mozilla.org/docs/Web/API/Canvas_API) for more methods
- **Experiment** with different drawing functions, colours, and animations
**Technical Requirements:**
- **Use** correct canvas setup wit `getContext('2d')`
- **Include** meaningful comments to explain how you take do am
- **Test** your code proper so e no go get error
- **Apply** modern JavaScript syntax (const/let, arrow functions)
**Creative Expression:**
- **Focus** on one Canvas API feature but explore am well well
- **Add** your own creative touch to make di project personal
- **Consider** how your project fit join bigger app
### Submission Guidelines
Send your finished project as one HTML file wey get embedded CSS and JavaScript, or as different files inside one folder. Add small comment wey explain your creative choices and di Canvas API features wey you try.
## Rubric
| Criteria | Exemplary | Adequate | Needs Improvement |
|----------|-----------|----------|-------------------|
| **Technical Implementation** | Canvas API used creatively with many features, code run perfect, modern JavaScript syntax dey apply | Canvas API used correct, code dey run but get small issues, basic implementation | Canvas API try but code get errors or e no run |
| **Creativity and Design** | Very original idea with fine visual, show say you explore di Canvas feature well well | Good use of Canvas features with some creative tins, visual solid | Basic implementation, little creativity or visual appeal |
| **Code Quality** | Code well arranged, comments dey follow best practices, efficient algorithms | Clean code with some comments, follow basic coding rules | Code no dey organized, few comments, inefficient implementation |
## Reflection Questions
After you finish your project, think about these questions:
1. **Which Canvas API feature you choose and why?**
2. **Which challenges you face as you dey build your project?**
3. **How you fit extend dis project to become bigger app or game?**
4. **Which other Canvas API features you go like explore next?**
> 💡 **Pro Tip**: Start with simple tori come add complexity small by small. Simple project wey you do well better pass big project wey no work well!
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Wetin I wan talk**:
Dis document na wetin AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator) translate. Even though we try make e correct, abeg sabi say automated translation fit get mistake or no too correct well. The original document wey e dey for im own language na im be the correct one. If na serious matter, better make pipo wey sabi translate am well well do am. We no go responsible if anybody misunderstand or mix up tins because of dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,899 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "8c55a2bd4bc0ebe4c88198fd563a9e09",
"translation_date": "2026-01-08T14:36:55+00:00",
"source_file": "6-space-game/3-moving-elements-around/README.md",
"language_code": "pcm"
}
-->
# Build a Space Game Part 3: Adding Motion
```mermaid
journey
title Your Game Animation Journey
section Movement Basics
Understand motion principles: 3: Student
Learn coordinate updates: 4: Student
Implement basic movement: 4: Student
section Player Controls
Handle keyboard events: 4: Student
Prevent default behaviors: 5: Student
Create responsive controls: 5: Student
section Game Systems
Build game loop: 5: Student
Manage object lifecycle: 5: Student
Implement pub/sub pattern: 5: Student
```
Think about your favorite games wetin dey make dem sweet no be only fine graphics, na how everything dey move and respond to wetin you dey do. Right now, your space game be like beautiful picture, but we go add movement wey go make am live.
When NASA engineers write code for Apollo mission guidance computer, dem face the same yawa: how you go make spacecraft respond to pilot input plus automatically adjust course? The principle wey we go learn today na the same kind thing how to manage player-controlled movement with automatic system behaviors.
For this lesson, you go learn how to make spaceship waka glide for screen, respond to player command, and create smooth movement pattern dem. We go break am down into small concepts wey dey build on each other naturally.
By the end, your players go dey fly their hero ship around the screen while enemy ship go dey patrol for up. Most important, you go sabi the core principle wey dey make game movement system work.
```mermaid
mindmap
root((Game Animation))
Movement Types
Player Controlled
Automatic Motion
Physics Based
Scripted Paths
Event Handling
Keyboard Input
Mouse Events
Touch Controls
Default Prevention
Game Loop
Update Logic
Render Frame
Clear Canvas
Frame Rate Control
Object Management
Position Updates
Collision Detection
Lifecycle Management
State Tracking
Communication
Pub/Sub Pattern
Event Emitters
Message Passing
Loose Coupling
```
## Pre-Lecture Quiz
[Pre-lecture quiz](https://ff-quizzes.netlify.app/web/quiz/33)
## Understanding Game Movement
Games dey come alive when things start to move, and basically two ways e dey happen:
- **Player-controlled movement**: When you press key or click mouse, something go move. Na the direct connection between you and your game world.
- **Automatic movement**: When game itself decide to move things like enemy ship wey suppose patrol screen whether you dey do anything or not.
Making object move for computer screen simple pass wetin you fit think. You remember those x and y coordinates from math class? Na the exact thing we dey use here. When Galileo track Jupiter moons for 1610, na the same thing e dey do plotting position over time to understand movement pattern.
To move things on screen na like to create flipbook animation you need follow these three simple steps:
```mermaid
flowchart LR
A["Frame N"] --> B["Update Positions"]
B --> C["Clear Canvas"]
C --> D["Draw Objects"]
D --> E["Frame N+1"]
E --> F{Continue?}
F -->|Yes| B
F -->|No| G["Game Over"]
subgraph "Animation Cycle"
H["1. Calculate new positions"]
I["2. Erase previous frame"]
J["3. Render new frame"]
end
style B fill:#e1f5fe
style C fill:#ffebee
style D fill:#e8f5e8
```
1. **Update the position** Change where your object suppose dey (fit move am 5 pixels go right)
2. **Erase the old frame** Clear screen so you no go see any ghostly trail
3. **Draw the new frame** Put your object for the new place
If you do am fast, bam! You get smooth movement wey make sense to players.
E go fit look like this for code:
```javascript
// Set di hero location
hero.x += 5;
// Clear di rectangle wey hold di hero
ctx.clearRect(0, 0, canvas.width, canvas.height);
// Draw di game background and hero again
ctx.fillRect(0, 0, canvas.width, canvas.height);
ctx.fillStyle = "black";
ctx.drawImage(heroImg, hero.x, hero.y);
```
**This na wetin dis code dey do:**
- **Update** hero x-coordinate by 5 pixels to move am horizontally
- **Clear** whole canvas area to remove previous frame
- **Fill** canvas with black background color
- **Redraw** hero image for the new position
✅ You fit reason why to dey redraw your hero plenty time per second fit dey cost performance? Read about [alternatives to this pattern](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Optimizing_canvas).
## Handle keyboard events
Na here we connect player input to game action. When person press spacebar to fire laser or tap arrow key to dodge asteroid, your game need detect and respond to that input.
Keyboard events dey happen for window level, meaning your entire browser window dey listen for keypress. Mouse clicks fit connect to specific elements (like button click). For our space game, we go focus on keyboard controls cause na the one wey give players classic arcade feel.
This remind me how telegraph operators for 1800s translate morse code input to meaningful message we dey do similar, translating keypress to game command.
To handle event, you need use window's `addEventListener()` method and give am two input parameters. The first na name of event, for example `keyup`. The second na function wey suppose run when event happen.
See example below:
```javascript
window.addEventListener('keyup', (evt) => {
// evt.key = na di string way represent di key
if (evt.key === 'ArrowUp') {
// do somtin
}
});
```
**Breaking wetin happen here down:**
- **Listen** for keyboard events on entire window
- **Capture** event object wey get info about which key dem press
- **Check** if the key wey dem press match specific key (for here na up arrow)
- **Run** code when the condition complete
For key events, you get two property for event wey you fit use check which key dem press:
- `key` - na string form of pressed key, like `'ArrowUp'`
- `keyCode` - na number form, like `37`, mean `ArrowLeft`
✅ Manipulate key event no only help for game development. Wetin other uses you fit think for this technique?
```mermaid
sequenceDiagram
participant User
participant Browser
participant EventSystem
participant GameLogic
participant Hero
User->>Browser: Press ArrowUp key
Browser->>EventSystem: keydown event
EventSystem->>EventSystem: preventDefault()
EventSystem->>GameLogic: emit('KEY_EVENT_UP')
GameLogic->>Hero: hero.y -= 5
Hero->>Hero: Update position
Note over Browser,GameLogic: Event flow dey stop browser default tins
Note over GameLogic,Hero: Pub/sub pattern dey make clean communication
```
### Special keys: make you watch sharp!
Some keys get browser behavior wey go fit spoil your game. Arrow keys dey scroll page and spacebar go jump down these na wetin you no want as person dey try pilot their spaceship.
We fit stop these default behavior make our game handle the input instead. Na similar way early computer programmers dey override system interrupts to create custom behavior na like that we dey do at browser level. See how:
```javascript
const onKeyDown = function (e) {
console.log(e.keyCode);
switch (e.keyCode) {
case 37:
case 39:
case 38:
case 40: // Arrow keys
case 32:
e.preventDefault();
break; // Space
default:
break; // no make e block oda keys
}
};
window.addEventListener('keydown', onKeyDown);
```
**Understanding dis prevention code:**
- **Check** for specific key codes wey fit cause unwanted browser behavior
- **Prevent** default browser action for arrow keys and spacebar
- **Allow** other keys to work normally
- **Use** `e.preventDefault()` to stop browser built-in behavior
### 🔄 **Pedagogical Check-in**
**Event Handling Understanding**: Before you move go automatic movement, make sure say you fit:
- ✅ Explain difference between `keydown` and `keyup` event
- ✅ Understand why we dey prevent default browser behaviors
- ✅ Talk how event listeners connect user input to game logic
- ✅ Identify keys wey fit interfere with game controls
**Quick Self-Test**: Wetin go happen if you no prevent default behavior for arrow keys?
*Answer: Browser go scroll page, e go spoil game movement*
**Event System Architecture**: Now you sabi:
- **Window-level listening**: Capture events for browser level
- **Event object properties**: `key` strings vs `keyCode` numbers
- **Default prevention**: Stop unwanted browser behavior
- **Conditional logic**: Respond to specific key combinations
## Game induced movement
Now we go talk about objects wey dey move without player input. Think about enemy ships wey dey cruise across screen, bullets wey dey fly straight, or clouds wey dey drift for background. This autonomous movement dey make your game world feel alive even when nobody dey touch controls.
We dey use JavaScript built-in timer to update position at regular time. This concept be like how pendulum clock sabi work na regular machine dey trigger consistent timed actions. Here how simple e be:
```javascript
const id = setInterval(() => {
// Comot di enemy fo di y axis
enemy.y += 10;
}, 100);
```
**This movement code dey do:**
- **Create** timer wey run every 100 milliseconds
- **Update** enemy y-coordinate by 10 pixels every time
- **Store** interval ID so we fit stop am later if need be
- **Move** enemy automatically go down screen
## The game loop
Dis one na the concept wey join everything together the game loop. If your game be movie, the game loop na the film projector, wey dey show frame after frame so fast that everything go dey move smooth.
Every game dey get this kind loop wey dey run behind scenes. Na function wey go update all game objects, redraw screen, and dey repeat dis process. E dey keep track of your hero, all the enemies, any laser wey dey fly the whole game state.
This concept remind me how early film animator like Walt Disney dey redraw characters frame by frame to create movement illusion. Na same thing we dey do, just say na code instead of pencil.
This na how game loop fit look for code:
```mermaid
flowchart TD
A["Start Game Loop"] --> B["Clear Canvas"]
B --> C["Fill Background"]
C --> D["Update Game Objects"]
D --> E["Draw Hero"]
E --> F["Draw Enemies"]
F --> G["Draw UI Elements"]
G --> H["Wait for Next Frame"]
H --> I{Game Running?}
I -->|Yes| B
I -->|No| J["End Game"]
subgraph "Frame Rate Control"
K["60 FPS = 16.67ms"]
L["30 FPS = 33.33ms"]
M["10 FPS = 100ms"]
end
style B fill:#ffebee
style D fill:#e1f5fe
style E fill:#e8f5e8
style F fill:#e8f5e8
```
```javascript
const gameLoopId = setInterval(() => {
function gameLoop() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.fillStyle = "black";
ctx.fillRect(0, 0, canvas.width, canvas.height);
drawHero();
drawEnemies();
drawStaticObjects();
}
gameLoop();
}, 200);
```
**Understanding game loop structure:**
- **Clear** whole canvas to remove previous frame
- **Fill** background with solid color
- **Draw** all game objects for their current position
- **Repeat** dis every 200 milliseconds to create smooth animation
- **Manage** frame rate by controlling interval timing
## Continuing the Space Game
Now we go add movement to the static scene we build before. We go transform am from picture to interactive experience. We go work am step by step to make sure each part build on the one before.
Carry code from where we stop for previous lesson (or start with code wey dey inside the [Part II- starter](../../../../6-space-game/3-moving-elements-around/your-work) folder if you want new start).
**Na wetin we dey build today:**
- **Hero controls**: Arrow keys go pilot your spaceship around screen
- **Enemy movement**: Those alien ships go start to waka
Make we start to implement these features.
## Recommended steps
Find the files wey dem don create for you for `your-work` sub folder. E suppose get these:
```bash
-| assets
-| enemyShip.png
-| player.png
-| index.html
-| app.js
-| package.json
```
You go start your project for `your-work` folder by to type:
```bash
cd your-work
npm start
```
**Wetinh this command dey do:**
- **Go** your project directory
- **Start** HTTP Server for address `http://localhost:5000`
- **Serve** your game files so you fit test am for browser
The command up there go start HTTP Server for address `http://localhost:5000`. Open browser and put that address, right now e suppose render the hero plus all enemies; nothing dey move yet!
### Add code
1. **Add dedicated objects** for `hero` and `enemy` and `game object`, dem suppose get `x` and `y` properties. (Remember the part wey talk about [Inheritance or composition](../README.md)).
*HINT* `game object` na the one wey get `x` and `y` and fit draw itself for canvas.
> **Tip**: Start with adding new `GameObject` class with constructor like below, then draw am for canvas:
```javascript
class GameObject {
constructor(x, y) {
this.x = x;
this.y = y;
this.dead = false;
this.type = "";
this.width = 0;
this.height = 0;
this.img = undefined;
}
draw(ctx) {
ctx.drawImage(this.img, this.x, this.y, this.width, this.height);
}
}
```
**Understanding this base class:**
- **Define** common properties wey all game objects share (position, size, image)
- **Include** `dead` flag to track if object suppose remove
- **Provide** `draw()` method wey go render object on canvas
- **Set** default values for properties wey child classes fit override
```mermaid
classDiagram
class GameObject {
+x: number
+y: number
+dead: boolean
+type: string
+width: number
+height: number
+img: Image
+draw(ctx)
}
class Hero {
+speed: number
+type: "Hero"
+width: 98
+height: 75
}
class Enemy {
+type: "Enemy"
+width: 98
+height: 50
+setInterval()
}
GameObject <|-- Hero
GameObject <|-- Enemy
class EventEmitter {
+listeners: object
+on(message, listener)
+emit(message, payload)
}
```
Now, extend dis `GameObject` make you create `Hero` and `Enemy`:
```javascript
class Hero extends GameObject {
constructor(x, y) {
super(x, y);
this.width = 98;
this.height = 75;
this.type = "Hero";
this.speed = 5;
}
}
```
```javascript
class Enemy extends GameObject {
constructor(x, y) {
super(x, y);
this.width = 98;
this.height = 50;
this.type = "Enemy";
const id = setInterval(() => {
if (this.y < canvas.height - this.height) {
this.y += 5;
} else {
console.log('Stopped at', this.y);
clearInterval(id);
}
}, 300);
}
}
```
**Key concepts for these classes:**
- **Inherit** from `GameObject` using `extends` keyword
- **Call** parent constructor with `super(x, y)`
- **Set** specific size and properties for each object type
- **Implement** automatic movement for enemy using `setInterval()`
2. **Add key-event handlers** to handle key navigation (move hero up/down left/right)
*REMEMBER* na Cartesian system, top-left na `0,0`. Make sure say you add code to stop *default behavior*
> **Tip**: Create your `onKeyDown` function and attach am to window:
```javascript
const onKeyDown = function (e) {
console.log(e.keyCode);
// Add de code wey dey from di lesson wey dey above to stop di default behavior
switch (e.keyCode) {
case 37:
case 39:
case 38:
case 40: // Arrow keys
case 32:
e.preventDefault();
break; // Space
default:
break; // no block oda keys
}
};
window.addEventListener("keydown", onKeyDown);
```
**What this event handler dey do:**
- **Listen** for keydown event on entire window
- **Log** the key code to help debug which keys dey press
- **Prevent** default browser behavior for arrow keys and spacebar
- **Allow** other keys work normally
Check your browser console now, watch the keystroke wey dey log.
3. **Implement** the [Pub sub pattern](../README.md), dis one go keep your code clean as you dey follow the next steps.
Publish-Subscribe pattern help organize code by separating event detection from event handling. E make your code modular and easier to maintain.
To do last part you fit:
1. **Add event listener** on window:
```javascript
window.addEventListener("keyup", (evt) => {
if (evt.key === "ArrowUp") {
eventEmitter.emit(Messages.KEY_EVENT_UP);
} else if (evt.key === "ArrowDown") {
eventEmitter.emit(Messages.KEY_EVENT_DOWN);
} else if (evt.key === "ArrowLeft") {
eventEmitter.emit(Messages.KEY_EVENT_LEFT);
} else if (evt.key === "ArrowRight") {
eventEmitter.emit(Messages.KEY_EVENT_RIGHT);
}
});
```
**What this event system dey do:**
- **Detect** keyboard input and convert am to custom game event
- **Separate** input detection from game logic
- **Make** am easier to change controls later without touching game code
- **Allow** multiple systems to respond to same input
```mermaid
flowchart TD
A["Keyboard Input"] --> B["Window Event Listener"]
B --> C["Event Emitter"]
C --> D["KEY_EVENT_UP"]
C --> E["KEY_EVENT_DOWN"]
C --> F["KEY_EVENT_LEFT"]
C --> G["KEY_EVENT_RIGHT"]
D --> H["Hero Movement"]
D --> I["Sound System"]
D --> J["Visual Effects"]
E --> H
F --> H
G --> H
style A fill:#e1f5fe
style C fill:#e8f5e8
style H fill:#fff3e0
```
2. **Create EventEmitter class** to publish and subscribe to messages:
```javascript
class EventEmitter {
constructor() {
this.listeners = {};
}
on(message, listener) {
if (!this.listeners[message]) {
this.listeners[message] = [];
}
this.listeners[message].push(listener);
}
3. **Add constants** and set up EventEmitter:
```javascript
const Messages = {
KEY_EVENT_UP: "KEY_EVENT_UP",
KEY_EVENT_DOWN: "KEY_EVENT_DOWN",
KEY_EVENT_LEFT: "KEY_EVENT_LEFT",
KEY_EVENT_RIGHT: "KEY_EVENT_RIGHT",
};
let heroImg,
enemyImg,
laserImg,
canvas, ctx,
gameObjects = [],
hero,
eventEmitter = new EventEmitter();
```
**Understanding the setup:**
- **Define** message constants to prevent typo and make refactoring easy
- **Declare** variables for images, canvas context, and game state
- **Create** global event emitter for pub-sub system
- **Dey start** one array dat go hold all game objects
4. **Start di game**
```javascript
function initGame() {
gameObjects = [];
createEnemies();
createHero();
eventEmitter.on(Messages.KEY_EVENT_UP, () => {
hero.y -= 5;
});
eventEmitter.on(Messages.KEY_EVENT_DOWN, () => {
hero.y += 5;
});
eventEmitter.on(Messages.KEY_EVENT_LEFT, () => {
hero.x -= 5;
});
4. **Arrange di game loop**
Change di `window.onload` function so e go start di game and arrange one game loop wey dey run well for correct time. You go add one laser beam join:
```javascript
window.onload = async () => {
canvas = document.getElementById("canvas");
ctx = canvas.getContext("2d");
heroImg = await loadTexture("assets/player.png");
enemyImg = await loadTexture("assets/enemyShip.png");
laserImg = await loadTexture("assets/laserRed.png");
initGame();
const gameLoopId = setInterval(() => {
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.fillStyle = "black";
ctx.fillRect(0, 0, canvas.width, canvas.height);
drawGameObjects(ctx);
}, 100);
};
```
**How di game setup dey work:**
- **Dey wait** for di page to finish load before e start
- **Dey find** di canvas element and im 2D render context
- **Dey load** all di image assets asynchronous using `await`
- **Dey start** di game loop wey go run every 100ms (10 FPS)
- **Dey clear** and redraw di whole screen every frame
5. **Add code** wey go move enemies for one certain interval
Change di `createEnemies()` function to create di enemies and push dem into di new gameObjects class:
```javascript
function createEnemies() {
const MONSTER_TOTAL = 5;
const MONSTER_WIDTH = MONSTER_TOTAL * 98;
const START_X = (canvas.width - MONSTER_WIDTH) / 2;
const STOP_X = START_X + MONSTER_WIDTH;
for (let x = START_X; x < STOP_X; x += 98) {
for (let y = 0; y < 50 * 5; y += 50) {
const enemy = new Enemy(x, y);
enemy.img = enemyImg;
gameObjects.push(enemy);
}
}
}
```
**Wetin di enemy creation dey do:**
- **Dey calculate** the correct place wey go put enemies so dem balance for middle
- **Dey create** grid of enemies with nested loops
- **Dey assign** di enemy image to each enemy object
- **Dey add** every enemy to di global game objects array
and add one `createHero()` function to do similar process for di hero.
```javascript
function createHero() {
hero = new Hero(
canvas.width / 2 - 45,
canvas.height - canvas.height / 4
);
hero.img = heroImg;
gameObjects.push(hero);
}
```
**Wetin di hero creation dey do:**
- **Dey put** di hero for bottom middle of di screen
- **Dey assign** di hero image to di hero object
- **Dey add** di hero to di game objects array make e fit render
and last, add one `drawGameObjects()` function so e go start di drawing:
```javascript
function drawGameObjects(ctx) {
gameObjects.forEach(go => go.draw(ctx));
}
```
**How di drawing function dey work:**
- **Dey run through** all di game objects inside di array
- **Dey call** di `draw()` method on each object
- **Dey pass** di canvas context make objects fit render themselves
### 🔄 **Pedagogical Check-in**
**Complete Game System Understanding**: Make sure say you sabi di whole architecture well:
- ✅ How inheritance dey make Hero and Enemy share common GameObject properties?
- ✅ Why pub/sub pattern dey make your code easy to maintain?
- ✅ Wetin di game loop dey do for smooth animation creation?
- ✅ How event listeners dey connect user input to game object behavior?
**System Integration**: Your game dey show now:
- **Object-Oriented Design**: Base classes with special inheritance
- **Event-Driven Architecture**: Pub/sub pattern for loose coupling
- **Animation Framework**: Game loop with consistent frame updates
- **Input Handling**: Keyboard events with default prevention
- **Asset Management**: Image loading and sprite rendering
**Professional Patterns**: You don implement:
- **Separation of Concerns**: Input, logic and rendering separated
- **Polymorphism**: All game objects dey share same drawing interface
- **Message Passing**: Clean communication between components
- **Resource Management**: Efficient sprite and animation handling
Your enemies suppose don start to advance for your hero spaceship!
}
}
```
and add a `createHero()` function to do a similar process for the hero.
```javascript
function createHero() {
hero = new Hero(
canvas.width / 2 - 45,
canvas.height - canvas.height / 4
);
hero.img = heroImg;
gameObjects.push(hero);
}
```
and last, add one `drawGameObjects()` function to start di drawing:
```javascript
function drawGameObjects(ctx) {
gameObjects.forEach(go => go.draw(ctx));
}
```
Your enemies suppose don start to advance for your hero spaceship!
---
## GitHub Copilot Agent Challenge 🚀
Here na challenge wey go improve your game polish: adding boundaries and smooth controls. Right now, your hero fit fly comot screen, and di movement fit feel choppy.
**Your Mission:** Make your spaceship feel more real by adding screen boundaries and smooth movement. E be like how NASA flight control systems dey stop spacecraft from pass safe operation limits.
**Wetin you go build:** Create system wey go keep your hero spaceship for inside screen, and make di controls smooth. When players hold down one arrow key, di ship go glide continuously instead of moving in small small steps. Try add visual feedback when di ship reach screen boundaries like small subtle effect wey show say na edge of play area.
Learn more about [agent mode](https://code.visualstudio.com/blogs/2025/02/24/introducing-copilot-agent-mode) here.
## 🚀 Challenge
Code organisation dey become very important as projects dey grow. You go notice say your file start dey crowded with functions, variables and classes wey dey mix together. E remind me how engineers wey arrange Apollo mission code gatz create clear, maintainable systems so many teams fit work together well.
**Your mission:**
Think as software architect. How you go arrange your code make six months later, you or teammate fit understand wetin dey happen? Even if everything dey one file for now, you fit create better organisation:
- **Group related functions** together with clear comment headers
- **Separate concerns** - keep game logic apart from rendering
- **Use consistent naming** conventions for variables and functions
- **Create modules** or namespaces to organize different parts of your game
- **Add documentation** to explain purpose of each major section
**Reflection questions:**
- Which parts of your code hardiest to understand when you return to dem?
- How you fit organize your code to make am easier for somebody else to contribute?
- Wetin suppose happen if you wan add new features like power-ups or different enemy types?
## Post-Lecture Quiz
[Post-lecture quiz](https://ff-quizzes.netlify.app/web/quiz/34)
## Review & Self Study
We don dey build everything from scratch, and e dey good for learning, but here na small secret some better JavaScript frameworks dey hide wey fit handle many heavy lifting for you. Once you comfortable with basics wey we cover so far, e good to [check wetin dey available](https://github.com/collections/javascript-game-engines).
Think of frameworks like having well-stocked toolbox instead of making every tool by hand. Dem fit solve lots of code organisation wahala wey we talk before, plus dem get features wey go take weeks to build yourself.
**Things worth exploring:**
- How game engines dey organize code you go surprise at clever patterns wey dem use
- Performance tricks to make canvas games run butter-smooth
- Modern JavaScript features wey fit make your code cleaner and easy to maintain
- Different ways to manage game objects and their relationships
## 🎯 Your Game Animation Mastery Timeline
```mermaid
timeline
title Game Animation & Interaction Learning Progression
section Movement Fundamentals (20 minutes)
Animation Principles: Frame-based animation
: Position updates
: Coordinate systems
: Smooth movement
section Event Systems (25 minutes)
User Input: Keyboard event handling
: Default behavior prevention
: Event object properties
: Window-level listening
section Game Architecture (30 minutes)
Object Design: Inheritance patterns
: Base class creation
: Specialized behaviors
: Polymorphic interfaces
section Communication Patterns (35 minutes)
Pub/Sub Implementation: Event emitters
: Message constants
: Loose coupling
: System integration
section Game Loop Mastery (40 minutes)
Real-time Systems: Frame rate control
: Update/render cycle
: State management
: Performance optimization
section Advanced Techniques (45 minutes)
Professional Features: Collision detection
: Physics simulation
: State machines
: Component systems
section Game Engine Concepts (1 week)
Framework Understanding: Entity-component systems
: Scene graphs
: Asset pipelines
: Performance profiling
section Production Skills (1 month)
Professional Development: Code organization
: Team collaboration
: Testing strategies
: Deployment optimization
```
### 🛠️ Your Game Development Toolkit Summary
After you finish this lesson, you don master:
- **Animation Principles**: Frame-based movement and smooth transitions
- **Event-Driven Programming**: Keyboard input handling with correct event management
- **Object-Oriented Design**: Inheritance hierarchies and polymorphic interfaces
- **Communication Patterns**: Pub/sub architecture for maintainable code
- **Game Loop Architecture**: Real-time update and rendering cycles
- **Input Systems**: User control mapping with default behavior prevention
- **Asset Management**: Sprite loading and efficient rendering techniques
### ⚡ **Wetin you fit do for next 5 minutes**
- [ ] Open browser console try `addEventListener('keydown', console.log)` to see keyboard events
- [ ] Create simple div element and move am using arrow keys
- [ ] Experiment with `setInterval` to create continuous movement
- [ ] Try prevent default behavior with `event.preventDefault()`
### 🎯 **Wetin you fit accomplish this hour**
- [ ] Complete post-lesson quiz and understand event-driven programming
- [ ] Build moving hero spaceship with full keyboard controls
- [ ] Implement smooth enemy movement patterns
- [ ] Add boundaries to prevent game objects from leaving screen
- [ ] Create basic collision detection between game objects
### 📅 **Your Week-Long Animation Journey**
- [ ] Complete full space game with polished movement and interactions
- [ ] Add advanced movement patterns like curves, acceleration and physics
- [ ] Implement smooth transitions and easing functions
- [ ] Create particle effects and visual feedback systems
- [ ] Optimize game performance for smooth 60fps gameplay
- [ ] Add mobile touch controls and responsive design
### 🌟 **Your Month-Long Interactive Development**
- [ ] Build complex interactive applications with advanced animation systems
- [ ] Learn animation libraries like GSAP or build your own animation engine
- [ ] Contribute to open source game development and animation projects
- [ ] Master performance optimization for graphics-heavy applications
- [ ] Create educational content about game development and animation
- [ ] Build portfolio showing advanced interactive programming skills
**Real-World Applications**: Your game animation skills fit directly for:
- **Interactive Web Applications**: Dynamic dashboards and real-time interfaces
- **Data Visualization**: Animated charts and interactive graphics
- **Educational Software**: Interactive simulations and learning tools
- **Mobile Development**: Touch-based games and gesture handling
- **Desktop Applications**: Electron apps with smooth animations
- **Web Animations**: CSS and JavaScript animation libraries
**Professional Skills You Gain**: You fit now:
- **Architect** event-driven systems wey fit scale with complexity
- **Implement** smooth animations using mathematical principles
- **Debug** complex interaction systems using browser developer tools
- **Optimize** game performance for different devices and browsers
- **Design** maintainable code structures using proven patterns
**Game Development Concepts You Master**:
- **Frame Rate Management**: Understanding FPS and timing controls
- **Input Handling**: Cross-platform keyboard and event systems
- **Object Lifecycle**: Creation, update and destruction patterns
- **State Synchronization**: Keep game state consistent across frames
- **Event Architecture**: Decoupled communication between game systems
**Next Level**: You ready to add collision detection, scoring systems, sound effects, or explore modern game frameworks like Phaser or Three.js!
🌟 **Achievement Unlocked**: You don build complete interactive game system with professional architecture patterns!
## Assignment
[Comment your code](assignment.md)
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document don translate wit AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator). Even though we try make e correct, abeg sabi say automated translations fit get errors or wahala. The original document wey e dey for im own language na im be the correct one. For important tins, make you use professional human translation. We no go responsible for any misunderstanding or wrong interpretation wey fit come from dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,38 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "c162b3b3a1cafc1483c8015e9b266f0d",
"translation_date": "2026-01-08T14:48:24+00:00",
"source_file": "6-space-game/3-moving-elements-around/assignment.md",
"language_code": "pcm"
}
-->
# Comment Your Code
## Instructions
Clean, well-documented code na important thing to maintain and share your projects. For this assignment, you go practice one of the most important habits of professional developers: to write clear, helpful comments wey go explain wetin your code dey do and how e dey work.
Make you check your current `app.js` file for your game folder, find how you go fit comment am and tidy am up. E easy for code to scatter, and now na good chance to add comments to make sure say your code dey readable so you fit use am later.
**Your task include:**
- **Add comments** wey go explain wetin each major section of code dey do
- **Document functions** with clear description of their purpose and parameters
- **Organize code** into logical blocks with section headers
- **Remove** any code wey no dey used or wey dey repeat
- **Use consistent** naming style for variables and functions
## Rubric
| Criteria | Exemplary | Adequate | Needs Improvement |
| -------- | --------- | -------- | ----------------- |
| **Code Documentation** | `app.js` code full with comments wey clear and helpful to explain all major sections and functions | `app.js` code get enough comments with basic explanations for most sections | `app.js` code no get enough comments and explanations no clear |
| **Code Organization** | Code organize well into logical blocks with clear section headers and consistent structure | Code get some organization with basic grouping for related functionality | Code disorganized small and e hard to follow |
| **Code Quality** | All variables and functions get descriptive names, no unused code, dey follow consistent conventions | Most code dey follow good naming practice with small-unused code | Variable names no clear, get unused code, style no consistent |
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document na wetin AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator) translate. Even though we dey try make am correct, abeg sabi say automated translation fit get mistakes or no too correct. The original document wey e write for im own language na the correct one. If na important matter, make person wey sabi translate am do am well. We no go take responsibility if person no understand or misunderstand from this translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,776 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "039b4d8ce65f5edd82cf48d9c3e6728c",
"translation_date": "2026-01-08T13:25:54+00:00",
"source_file": "6-space-game/4-collision-detection/README.md",
"language_code": "pcm"
}
-->
# Build a Space Game Part 4: Adding A Laser and Detect Collisions
```mermaid
journey
title Your Collision Detection Journey
section Physics Foundation
Understand rectangles: 3: Student
Learn intersection math: 4: Student
Grasp coordinate systems: 4: Student
section Game Mechanics
Implement laser firing: 4: Student
Add object lifecycle: 5: Student
Create collision rules: 5: Student
section System Integration
Build collision detection: 5: Student
Optimize performance: 5: Student
Test interaction systems: 5: Student
```
## Pre-Lecture Quiz
[Pre-lecture quiz](https://ff-quizzes.netlify.app/web/quiz/35)
Think about the moment in Star Wars wen Luke proton torpedoes hit di Death Star exhaust port. Dat exact collision detection change di fate of di galaxy! Inside games, collision detection dey work di same way - e dey determine wen objects dey interact and wetin go happen next.
For dis lesson, you go add laser weapons for your space game and put collision detection. Just like NASA mission planners dey calculate spacecraft trajectory to avoid debris, you go learn to detect wen game objects dey intersect. We go break am down into small steps wey go build once after the other.
By di end, you go get working combat system wey lasers go fit destroy enemies and collisions go trigger game events. Dis same collision principles dey used for everything from physics simulations to interactive web interfaces.
```mermaid
mindmap
root((Collision Detection))
Physics Concepts
Rectangle Boundaries
Intersection Testing
Coordinate Systems
Separation Logic
Game Objects
Laser Projectiles
Enemy Ships
Hero Character
Collision Zones
Lifecycle Management
Object Creation
Movement Updates
Destruction Marking
Memory Cleanup
Event Systems
Keyboard Input
Collision Events
Game State Changes
Audio/Visual Effects
Performance
Efficient Algorithms
Frame Rate Optimization
Memory Management
Spatial Partitioning
```
✅ Do small research on di very first computer game wey anybody write. Wetin e fit do?
## Collision detection
Collision detection dey work like proximity sensors wey dey Apollo lunar module - e dey always check distance and dey trigger alerts wen objects get too close. For games, dis system dey determine wen objects dey interact and wetin suppose happen next.
Di approach wey we go use na sey every game object be rectangle, like how air traffic control systems dey use simplified geometric shapes to track aircraft. Dis rectangular method fit look basic, but e dey efficient for computer plus e dey work well for most game situations.
### Rectangle representation
Every game object need coordinate boundaries, like how Mars Pathfinder rover map im location for Mars surface. Dis na how we dey define boundary coordinates:
```mermaid
flowchart TD
A["🎯 Game Object"] --> B["📍 Position (x, y)"]
A --> C["📏 Dimensions (width, height)"]
B --> D["Top: y"]
B --> E["Left: x"]
C --> F["Bottom: y + height"]
C --> G["Right: x + width"]
D --> H["🔲 Rectangle Bounds"]
E --> H
F --> H
G --> H
H --> I["Collision Detection Ready"]
style A fill:#e3f2fd
style H fill:#e8f5e8
style I fill:#fff3e0
```
```javascript
rectFromGameObject() {
return {
top: this.y,
left: this.x,
bottom: this.y + this.height,
right: this.x + this.width
}
}
```
**Make we break am down:**
- **Top edge**: Na just where your object start vertically (na im y position be dat)
- **Left edge**: Where e start horizontally (na im x position be dat)
- **Bottom edge**: Add height to y position - now you know where e end!
- **Right edge**: Add width to x position - and now you get full boundary
### Intersection algorithm
To detect rectangle intersections na like how Hubble Space Telescope dey figure if celestial objects dey overlap for im field of view. Di algorithm dey check for separation:
```mermaid
flowchart LR
A["Rectangle 1"] --> B{"Separation Tests"}
C["Rectangle 2"] --> B
B --> D["R2 left pass R1 right?"]
B --> E["R2 right no reach R1 left?"]
B --> F["R2 top pass R1 bottom?"]
B --> G["R2 bottom no reach R1 top?"]
D --> H{"Any True?"}
E --> H
F --> H
G --> H
H -->|Yes| I["❌ No Collision"]
H -->|No| J["✅ Collision Detected"]
style B fill:#e3f2fd
style I fill:#ffebee
style J fill:#e8f5e8
```
```javascript
function intersectRect(r1, r2) {
return !(r2.left > r1.right ||
r2.right < r1.left ||
r2.top > r1.bottom ||
r2.bottom < r1.top);
}
```
**Di separation test dey work like radar systems:**
- E go check if rectangle 2 dey completely for right side of rectangle 1?
- E go check if rectangle 2 dey completely for left side of rectangle 1?
- E go check if rectangle 2 dey completely below rectangle 1?
- E go check if rectangle 2 dey completely above rectangle 1?
If none of dis conditions true, di rectangles go dey overlapping. Dis kind approach na like how radar operators dey determine if two aircraft dey at safe distance.
## Managing object lifecycles
Wen laser hit enemy, both objects go need comot from game. But to delete objects for middle of loop fit cause crash - na lesson dem learn hard way for early computer systems like Apollo Guidance Computer. Instead, we go use "mark for deletion" wey dey remove objects safely between frames.
```mermaid
stateDiagram-v2
[*] --> Active: Object Create
Active --> Collided: Collision Detect
Collided --> MarkedDead: Set dead = true
MarkedDead --> Filtered: Next Frame
Filtered --> [*]: Object Remov
Active --> OutOfBounds: Comot Screen
OutOfBounds --> MarkedDead
note right of MarkedDead
Safe to continue
current frame
end note
note right of Filtered
Objects remov
between frames
end note
```
Dis na how we dey mark somtin for removal:
```javascript
// Mark objek for komot
enemy.dead = true;
```
**Why dis approach work:**
- We go mark di object as "dead" but no go delete am immediately
- Dis one go allow di current game frame finish well
- No crashes for trying to use object wey don already go!
Then filter out objects wey we mark before next render cycle:
```javascript
gameObjects = gameObjects.filter(go => !go.dead);
```
**Wetin dis filtering dey do:**
- E go create fresh list wey get only "living" objects
- E go throway anything wey mark as dead
- E go keep your game dey run smoothly
- E go prevent memory bloat from plenty destroyed objects wey dey pile up
## Implementing laser mechanics
Laser projectiles for games dey work like photon torpedoes for Star Trek - dem be separate objects wey dey travel straight line till dem hit somtin. Every time you press spacebar, e go create new laser object wey go move across screen.
To make dis one work, we need arrange few things:
**Key components to implement:**
- **Create** laser objects wey go come from hero position
- **Handle** keyboard input to trigger laser creation
- **Manage** laser movement and lifecycle
- **Implement** visual representation for laser projectiles
## Implementing firing rate control
To fire unlimited times go overwhelm di game engine and make di game too easy. Real weapon systems dey face dis kind wahala too - even USS Enterprise phasers need time to recharge between shots.
We go implement cooldown system wey go prevent rapid-fire spam but still keep controls responsive:
```mermaid
sequenceDiagram
participant Player
participant Weapon
participant Cooldown
participant Game
Player->>Weapon: Press Spacebar
Weapon->>Cooldown: Check if cool
alt Weapon dey Ready
Cooldown->>Weapon: cool = true
Weapon->>Game: Create Laser
Weapon->>Cooldown: Start new cooldown
Cooldown->>Cooldown: cool = false
Note over Cooldown: Wait 500ms
Cooldown->>Cooldown: cool = true
else Weapon dey Cool
Cooldown->>Weapon: cool = false
Weapon->>Player: No action
end
```
```javascript
class Cooldown {
constructor(time) {
this.cool = false;
setTimeout(() => {
this.cool = true;
}, time);
}
}
class Weapon {
constructor() {
this.cooldown = null;
}
fire() {
if (!this.cooldown || this.cooldown.cool) {
// Mak laser projectile
this.cooldown = new Cooldown(500);
} else {
// Weapon dey still cool down
}
}
}
```
**How di cooldown dey work:**
- Wen e first create, weapon start "hot" (no fit fire yet)
- After timeout period, e become "cool" (ready to fire)
- Before firing, we go check: "Weapon cool?"
- Dis one go prevent spam clicking but keep control responsive
✅ Refer to lesson 1 for di space game series to remind yourself about cooldowns.
## Building the collision system
You go extend your space game code to add collision detection system. Like di International Space Station automated collision avoidance system, your game go dey monitor object position dey go respond to intersections.
Starting from your previous lesson code, you go add collision detection with specific rules to control object interactions.
> 💡 **Pro Tip**: Di laser sprite dey inside your assets folder and e dey referenced in your code, ready for use.
### Collision rules to implement
**Game mechanics to add:**
1. **Laser hit enemy**: Enemy object go destroy wen laser projectile hit am
2. **Laser hit screen boundary**: Laser go remove wen e reach top edge of screen
3. **Enemy and hero collision**: Both objects go destroy wen dem intersect
4. **Enemy reach bottom**: Game over if enemies reach screen bottom
### 🔄 **Pedagogical Check-in**
**Collision Detection Foundation**: Before you implement, make sure you sabi:
- ✅ How rectangle boundaries dey define collision zones
- ✅ Why separation test better than intersection calcuation
- ✅ Importance of object lifecycle management for game loops
- ✅ How event-driven systems dey coordinate collision response
**Quick Self-Test**: Wetin go happen if you delete objects immediately instead of marking dem?
*Answer: Mid-loop deletion fit cause crash or skip objects during iteration*
**Physics Understanding**: Now you understand:
- **Coordinate Systems**: How position and size create boundaries
- **Intersection Logic**: Maths principles behind collision detection
- **Performance Optimization**: Why efficient algorithms important for real-time systems
- **Memory Management**: Safe object lifecycle patterns for stability
## Setting up your development environment
Better news - we don set most ground for you already! All your game assets and basic structure dey inside `your-work` subfolder, ready for you to add di cool collision features.
### Project structure
```bash
-| assets
-| enemyShip.png
-| player.png
-| laserRed.png
-| index.html
-| app.js
-| package.json
```
**Understand file structure:**
- **Contains** all sprite images needed for game objects
- **Includes** main HTML document and JavaScript app file
- **Provides** package config for local development server
### Starting the development server
Go your project folder and start local server:
```bash
cd your-work
npm start
```
**Dis command dem do:**
- **Change** directory to your project folder
- **Start** local HTTP server at `http://localhost:5000`
- **Serve** your game files for testing and development
- **Enable** live development with automatic reload
Open your browser and go `http://localhost:5000` to see your current game state with hero and enemies on screen.
### Step-by-step implementation
Like how NASA take program Voyager spacecraft systematically, we go implement collision detection methodically, building each part step by step.
```mermaid
flowchart TD
A["1. Rectangle Bounds"] --> B["2. Intersection Detection"]
B --> C["3. Laser System"]
C --> D["4. Event Handling"]
D --> E["5. Collision Rules"]
E --> F["6. Cooldown System"]
G["Object Boundaries"] --> A
H["Physics Algorithm"] --> B
I["Projectile Creation"] --> C
J["Keyboard Input"] --> D
K["Game Logic"] --> E
L["Rate Limiting"] --> F
F --> M["🎮 Complete Game"]
style A fill:#e3f2fd
style B fill:#e8f5e8
style C fill:#fff3e0
style D fill:#f3e5f5
style E fill:#e0f2f1
style F fill:#fce4ec
style M fill:#e1f5fe
```
#### 1. Add rectangle collision bounds
First, make we teach our game objects how to describe their boundaries. Add dis method to your `GameObject` class:
```javascript
rectFromGameObject() {
return {
top: this.y,
left: this.x,
bottom: this.y + this.height,
right: this.x + this.width,
};
}
```
**Dis method dey do:**
- **Create** rectangle object with exact boundary coordinates
- **Calculate** bottom and right edges using position plus dimensions
- **Return** object ready for collision detection algorithm
- **Provide** standardized interface for all game objects
#### 2. Implement intersection detection
Make we create our collision detective - function wey fit tell when two rectangles dey overlap:
```javascript
function intersectRect(r1, r2) {
return !(
r2.left > r1.right ||
r2.right < r1.left ||
r2.top > r1.bottom ||
r2.bottom < r1.top
);
}
```
**Dis algorithm dey work by:**
- **Test** four separation conditions between rectangles
- **Return** `false` if any separation condition true
- **Indicate** collision when no separation dey
- **Use** negation logic for efficient intersection testing
#### 3. Implement laser firing system
Na here dia action dey start! Make we setup laser firing system.
##### Message constants
First, define some message types so different parts of our game fit talk with each other:
```javascript
KEY_EVENT_SPACE: "KEY_EVENT_SPACE",
COLLISION_ENEMY_LASER: "COLLISION_ENEMY_LASER",
COLLISION_ENEMY_HERO: "COLLISION_ENEMY_HERO",
```
**These constants provide:**
- **Standardize** event names across application
- **Enable** consistent communication between game systems
- **Prevent** typo for event handler registration
##### Keyboard input handling
Add space key detection to your key event listener:
```javascript
} else if(evt.keyCode === 32) {
eventEmitter.emit(Messages.KEY_EVENT_SPACE);
}
```
**Dis input handler:**
- **Detect** space key press with keyCode 32
- **Emit** standardized event message
- **Allow** decoupled firing logic
##### Event listener setup
Register firing behavior inside your `initGame()` function:
```javascript
eventEmitter.on(Messages.KEY_EVENT_SPACE, () => {
if (hero.canFire()) {
hero.fire();
}
});
```
**Dis event listener:**
- **Respond** to space key events
- **Check** firing cooldown status
- **Trigger** laser creation when allowed
Add collision handling for laser-enemy interaction:
```javascript
eventEmitter.on(Messages.COLLISION_ENEMY_LASER, (_, { first, second }) => {
first.dead = true;
second.dead = true;
});
```
**Dis collision handler:**
- **Receive** collision event data with both objects
- **Mark** both objects for removal
- **Ensure** proper cleanup after collision
#### 4. Create the Laser class
Implement laser projectile wey go move upward and handle im own lifecycle:
```javascript
class Laser extends GameObject {
constructor(x, y) {
super(x, y);
this.width = 9;
this.height = 33;
this.type = 'Laser';
this.img = laserImg;
let id = setInterval(() => {
if (this.y > 0) {
this.y -= 15;
} else {
this.dead = true;
clearInterval(id);
}
}, 100);
}
}
```
**Dis class implementation:**
- **Extend** GameObject to inherit basic functionality
- **Set** proper dimensions for laser sprite
- **Create** automatic upward movement using `setInterval()`
- **Handle** self-destruction wen e reach screen top
- **Manage** its own animation timing and cleanup
#### 5. Implement collision detection system
Create complete collision detection function:
```javascript
function updateGameObjects() {
const enemies = gameObjects.filter(go => go.type === 'Enemy');
const lasers = gameObjects.filter(go => go.type === "Laser");
// Test laser and enemy dem collision
lasers.forEach((laser) => {
enemies.forEach((enemy) => {
if (intersectRect(laser.rectFromGameObject(), enemy.rectFromGameObject())) {
eventEmitter.emit(Messages.COLLISION_ENEMY_LASER, {
first: laser,
second: enemy,
});
}
});
});
// Comot objects wey dem don destroy
gameObjects = gameObjects.filter(go => !go.dead);
}
```
**Dis collision system:**
- **Filter** game objects by type to test efficiently
- **Test** every laser against every enemy for intersections
- **Emit** collision events wen intersections detect
- **Clean** destroyed objects after collision process
> ⚠️ **Important**: Add `updateGameObjects()` to your main game loop inside `window.onload` to enable collision detection.
#### 6. Add cooldown system to Hero class
Improve Hero class with firing mechanics and rate limiting:
```javascript
class Hero extends GameObject {
constructor(x, y) {
super(x, y);
this.width = 99;
this.height = 75;
this.type = "Hero";
this.speed = { x: 0, y: 0 };
this.cooldown = 0;
}
fire() {
gameObjects.push(new Laser(this.x + 45, this.y - 10));
this.cooldown = 500;
let id = setInterval(() => {
if (this.cooldown > 0) {
this.cooldown -= 100;
} else {
clearInterval(id);
}
}, 200);
}
canFire() {
return this.cooldown === 0;
}
}
```
**Understand enhanced Hero class:**
- **Initialize** cooldown timer at zero (ready to fire)
- **Create** laser objects wey position above hero ship
- **Set** cooldown time to prevent rapid firing
- **Decrement** cooldown timer using interval updates
- **Provide** firing status check with `canFire()` method
### 🔄 **Pedagogical Check-in**
**Complete System Understanding**: Make sure you sabi how di collision system work:
- ✅ How rectangle boundaries fit enable efficient collision detection?
- ✅ Why object lifecycle management dey critical for game stability?
- ✅ How cooldown system dey prevent performance wahala?
- ✅ Wetin event-driven architecture role be for collision handling?
**System Integration**: Your collision detection dey show:
- **Mathematical Precision**: Rectangle intersection algorithm
- **Performance Optimization**: Efficient collision testing pattern
- **Memory Management**: Safe object creation and destruction
- **Event Coordination**: Decoupled system communication
- **Real-time Processing**: Frame-based update cycles
**Professional Patterns**: You don implement:
- **Separation of Concerns**: Physics, rendering, input separate
- **Object-Oriented Design**: Inheritance and polymorphism
- **State Management**: Object lifecycle and game state tracking
- **Performance Optimization**: Efficient algorithm for real-time use
### Testing your implementation
Your space game now get complete collision detection and combat mechanics. 🚀 Test these new features:
- **Move** wit arrow keys to check movement controls
- **Fire lasers** with spacebar - see how cooldown stop spam click
- **Watch collision** wen lasers hit enemies and remove dem
- **Check cleanup** as destroyed objects disappear from game
You don successfully implement collision detection system with same maths principles wey guide spacecraft navigation and robotics.
### ⚡ **Wetn You Fit Do for Di Next 5 Minutes**
- [ ] Open browser DevTools and set breakpoint for your collision detection function
- [ ] Try change laser speed or enemy movement to see collision effects
- [ ] Experiment with different cooldown values to test firing rates
- [ ] Add `console.log` statements to track collision events for real-time
### 🎯 **Wetin You Fit Achieve Dis Hour**
- [ ] Finish di post-lesson quiz and sabi di collision detection algorithms
- [ ] Add visual effects like explosions wen collisions happen
- [ ] Implement different kain projectiles wey get different properties
- [ ] Create power-ups wey go boost player abilities for small time
- [ ] Add sound effects to make collisions dey more satisfying
### 📅 **Your Week-Long Physics Programming**
- [ ] Complete di full space game wey get polished collision systems
- [ ] Implement advanced collision shapes beyond rectangles (circles, polygons)
- [ ] Add particle systems for realistic explosion effects
- [ ] Create complex enemy behaviour with collision avoidance
- [ ] Optimize collision detection for better performance with plenty objects
- [ ] Add physics simulation like momentum and realistic movement
### 🌟 **Your Month-Long Game Physics Mastery**
- [ ] Build games with advanced physics engines and realistic simulations
- [ ] Learn 3D collision detection and spatial partitioning algorithms
- [ ] Contribute to open source physics libraries and game engines
- [ ] Master performance optimization for graphics-intensive applications
- [ ] Create educational content about game physics and collision detection
- [ ] Build a portfolio wey show advanced physics programming skills
## 🎯 Your Collision Detection Mastery Timeline
```mermaid
timeline
title Collision Detection & Game Physics Learning Progression
section Foundation (10 minutes)
Rectangle Math: Coordinate systems
: Boundary calculations
: Position tracking
: Dimension management
section Algorithm Design (20 minutes)
Intersection Logic: Separation testing
: Overlap detection
: Performance optimization
: Edge case handling
section Game Implementation (30 minutes)
Object Systems: Lifecycle management
: Event coordination
: State tracking
: Memory cleanup
section Interactive Features (40 minutes)
Combat Mechanics: Projectile systems
: Weapon cooldowns
: Damage calculation
: Visual feedback
section Advanced Physics (50 minutes)
Real-time Systems: Frame rate optimization
: Spatial partitioning
: Collision response
: Physics simulation
section Professional Techniques (1 week)
Game Engine Concepts: Component systems
: Physics pipelines
: Performance profiling
: Cross-platform optimization
section Industry Applications (1 month)
Production Skills: Large-scale optimization
: Team collaboration
: Engine development
: Platform deployment
```
### 🛠️ Your Game Physics Toolkit Summary
After you don finish dis lesson, you don master:
- **Collision Mathematics**: Rectangle intersection algorithms and coordinate systems
- **Performance Optimization**: Efficient collision detection for real-time applications
- **Object Lifecycle Management**: Safe creation, updating, and destruction patterns
- **Event-Driven Architecture**: Decoupled systems for collision response
- **Game Loop Integration**: Frame-based physics updates and rendering coordination
- **Input Systems**: Responsive controls with rate limiting and feedback
- **Memory Management**: Efficient object pooling and cleanup strategies
**Real-World Applications**: Your collision detection skills fit apply straight to:
- **Interactive Simulations**: Scientific modeling and educational tools
- **User Interface Design**: Drag-and-drop interactions and touch detection
- **Data Visualization**: Interactive charts and clickable elements
- **Mobile Development**: Touch gesture recognition and collision handling
- **Robotics Programming**: Path planning and obstacle avoidance
- **Computer Graphics**: Ray tracing and spatial algorithms
**Professional Skills Gained**: Now you fit:
- **Design** efficient algorithms for real-time collision detection
- **Implement** physics systems wey fit scale with object complexity
- **Debug** complex interaction systems with mathematical principles
- **Optimize** performance for different hardware and browser capabilities
- **Architect** maintainable game systems with proven design patterns
**Game Development Concepts Mastered**:
- **Physics Simulation**: Real-time collision detection and response
- **Performance Engineering**: Optimized algorithms for interactive applications
- **Event Systems**: Decoupled communication between game components
- **Object Management**: Efficient lifecycle patterns for dynamic content
- **Input Handling**: Responsive controls with correct feedback
**Next Level**: You ready to explore advanced physics engines like Matter.js, implement 3D collision detection, or build complex particle systems!
🌟 **Achievement Unlocked**: You don build complete physics-based interaction system with professional-grade collision detection!
## GitHub Copilot Agent Challenge 🚀
Use the Agent mode to complete dis challenge:
**Description:** Improve di collision detection system by adding power-ups wey go spawn randomly and give temporary abilities when hero ship collect dem.
**Prompt:** Create PowerUp class wey extend GameObject and implement collision detection between di hero and power-ups. Add at least two types of power-ups: one wey dey increase fire rate (reduce cooldown) and another wey create temporary shield. Include spawn logic wey go create power-ups at random intervals and positions.
---
## 🚀 Challenge
Add explosion! Check di game assets inside [the Space Art repo](../../../../6-space-game/solution/spaceArt/readme.txt) and try add explosion wen di laser hit alien
## Post-Lecture Quiz
[Post-lecture quiz](https://ff-quizzes.netlify.app/web/quiz/36)
## Review & Self Study
Try play with di intervals for your game so far. Wetin happen wen you change dem? Read more about [JavaScript timing events](https://www.freecodecamp.org/news/javascript-timing-events-settimeout-and-setinterval/).
## Assignment
[Explore collisions](assignment.md)
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document don translate by AI translation service wey dem dey call [Co-op Translator](https://github.com/Azure/co-op-translator). Even though we dey try make am correct, abeg sabi say automated translation fit get some mistakes or wrong yan. Di original document wey e original language na di main correct source. For important tori dem, make person wey sabi human translator do am. We no go take responsibility if person no understand or dem interpret am wrong because of dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,64 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "124efddbb65166cddb38075ad6dae324",
"translation_date": "2026-01-08T13:35:26+00:00",
"source_file": "6-space-game/4-collision-detection/assignment.md",
"language_code": "pcm"
}
-->
# Explore Collisions
## Instructions
Apply your collision detection knowledge by creating a custom mini-game wey show different kain object interactions. Dis assignment go help you sabi collision mechanics through creative implementation and experiment.
### Project requirements
**Make small interactive game wey get:**
- **Plenty moving objects** wey person fit control with keyboard or mouse input
- **Collision detection system** wey use rectangle intersection principles from the lesson
- **Visual feedback** when collisions happen (object destruction, color changes, effects)
- **Game rules** wey make collisions get meaning and dey interesting
### Creative suggestions
**Try do one of these scenarios:**
- **Asteroid field**: Steer ship through dangerous space debris
- **Bumper cars**: Build physics-based collision arena
- **Meteor defense**: Protect Earth from incoming space rocks
- **Collection game**: Gather items and avoid obstacles
- **Territory control**: Objects wey dey compete to claim space
### Technical implementation
**Your solution suppose show:**
- Correct use of rectangle-based collision detection
- Event-driven programming for user input
- Object lifecycle management (creation and destruction)
- Clean code organization wit proper class structure
### Bonus challenges
**Make your game better with extra features:**
- **Particle effects** when collisions happen
- **Sound effects** for different collision types
- **Scoring system** based on collision results
- **Multiple collision types** with different behaviors
- **Progressive difficulty** wey increase over time
## Rubric
| Criteria | Exemplary | Adequate | Needs Improvement |
|----------|-----------|----------|-------------------|
| **Collision Detection** | Implements accurate rectangle-based collision detection with multiple object types and sophisticated interaction rules | Basic collision detection dey work correct with simple object interactions | Collision detection get wahala or no dey work consistent |
| **Code Quality** | Clean, well-organized code wit proper class structure, meaningful variable names, and correct comments | Code dey work but fit dey better organized or documented | Code hard to understand or no well structured |
| **User Interaction** | Responsive controls wit smooth gameplay, clear visual feedback, and engaging mechanics | Basic controls dey work wit enough feedback | Controls no dey respond or dey confusing |
| **Creativity** | Original concept wit unique features, visual polish, and innovative collision behaviors | Standard implementation wit some creative parts | Basic functionality without creative improvements |
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document don translate wit AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator). Even tho we dey try make am correct, abeg know say automated translation fit get mistakes or no too correct. Di original document wey e dey for im own language na di correct one wey you suppose refer. If na serious tins, make you use professional human translator. We no go responsible for any kian mis-understanding or wrong meaning wey fit come from dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,17 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "068cbb9b3c10a96d503f6cdd6c9ace8c",
"translation_date": "2026-01-08T14:59:43+00:00",
"source_file": "6-space-game/4-collision-detection/solution/README.md",
"language_code": "pcm"
}
-->
Dis na placeholder, wey I lef blank on purpose
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document don translate wit AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator). Even tho we dey try make am correct, abeg sabi say automated translation fit get errors or no too correct. Di original document wey dem write for im original language na di correct one to trust. For important info, e better make human professional translate am. We no go responsible if person misundastand or wrong interpret dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,17 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "068cbb9b3c10a96d503f6cdd6c9ace8c",
"translation_date": "2026-01-08T14:58:58+00:00",
"source_file": "6-space-game/4-collision-detection/your-work/README.md",
"language_code": "pcm"
}
-->
Dis na placeholder, e left blank on purpose.
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document don translate wit AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator). Even tho we dey try make am correct, abeg sabi say automated translation fit get mistakes or no too correct. The original document wey dem write for im own language na the main authority. For important info, make person wey sabi do proper human translation do am. We no go responsible for any wrong understanding or mistake wey fit come from to use dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,510 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "2ed9145a16cf576faa2a973dff84d099",
"translation_date": "2026-01-08T14:07:40+00:00",
"source_file": "6-space-game/5-keeping-score/README.md",
"language_code": "pcm"
}
-->
# Build a Space Game Part 5: Scoring and Lives
```mermaid
journey
title Your Game Design Journey
section Player Feedback
Understand scoring psychology: 3: Student
Learn visual communication: 4: Student
Design reward systems: 4: Student
section Technical Implementation
Canvas text rendering: 4: Student
State management: 5: Student
Event-driven updates: 5: Student
section Game Polish
User experience design: 5: Student
Balance challenge and reward: 5: Student
Create engaging gameplay: 5: Student
```
## Pre-Lecture Quiz
[Pre-lecture quiz](https://ff-quizzes.netlify.app/web/quiz/37)
You ready to make your space game feel like real game? Make we add scoring points and managing lives - na the main kian thing wey change early arcade games like Space Invaders from simple play into addictive entertainment. Na here your game go start to dey really playable.
```mermaid
mindmap
root((Game Feedback Systems))
Visual Communication
Text Rendering
Icon Display
Color Psychology
Layout Design
Scoring Mechanics
Point Values
Reward Timing
Progress Tracking
Achievement Systems
Life Management
Risk vs Reward
Player Agency
Difficulty Balance
Recovery Mechanics
User Experience
Immediate Feedback
Clear Information
Emotional Response
Engagement Loops
Implementation
Canvas API
State Management
Event Systems
Performance
```
## Drawing Text on Screen - Your Game's Voice
To show your score, we need learn how to put text for canvas. The `fillText()` method na your main tool for dis - na the same way wey dem dey use for old school arcade games to show scores and status information.
```mermaid
flowchart LR
A["📝 Text Content"] --> B["🎨 Styling"]
B --> C["📍 Positioning"]
C --> D["🖼️ Canvas Render"]
E["Font Family"] --> B
F["Font Size"] --> B
G["Color"] --> B
H["Alignment"] --> B
I["X Coordinate"] --> C
J["Y Coordinate"] --> C
style A fill:#e3f2fd
style B fill:#e8f5e8
style C fill:#fff3e0
style D fill:#f3e5f5
```
You fit control everything for how the text go look:
```javascript
ctx.font = "30px Arial";
ctx.fillStyle = "red";
ctx.textAlign = "right";
ctx.fillText("show this on the screen", 0, 0);
```
✅ Dive deep inside [adding text to a canvas](https://developer.mozilla.org/docs/Web/API/Canvas_API/Tutorial/Drawing_text) - you fit surprise yourself how you fit get creative with fonts and style!
## Lives - More Than Just a Number
For game design, "life" mean how many chance player get to make mistake. Dis idea come from pinball machines, where you go get many balls to play with. For early video games like Asteroids, lives mean say player fit take chance, learn from mistakes.
```mermaid
flowchart TD
A["🎮 Player Action"] --> B{"Risk Assessment"}
B --> C["High Risk, High Reward"]
B --> D["Safe Strategy"]
C --> E{"Outcome"}
D --> F["Steady Progress"]
E -->|Success| G["🏆 Big Points"]
E -->|Failure| H["💔 Lose Life"]
H --> I{"Lives Remaining?"}
I -->|Yes| J["🔄 Try Again"]
I -->|No| K["💀 Game Over"]
J --> B
G --> B
F --> B
style C fill:#ffebee
style D fill:#e8f5e8
style G fill:#e3f2fd
style H fill:#fff3e0
```
How e go show matter well well - to show ship icons instead of just "Lives: 3" dey give quick visual understanding, just like how early arcade machines use icon to talk across language wahala.
## Building Your Game's Reward System
Now we go put the main feedback systems wey dey keep players interested:
```mermaid
sequenceDiagram
participant Player
participant GameEngine
participant ScoreSystem
participant LifeSystem
participant Display
Player->>GameEngine: Shoot Enemy
GameEngine->>ScoreSystem: Comot Points
ScoreSystem->>ScoreSystem: +100 points
ScoreSystem->>Display: Change Score
Player->>GameEngine: Jam Enemy
GameEngine->>LifeSystem: Lose Life
LifeSystem->>LifeSystem: -1 life
LifeSystem->>Display: Change Lives
alt Lives > 0
LifeSystem->>Player: Continue Playin
else Lives = 0
LifeSystem->>GameEngine: Game Done
end
```
- **Scoring system**: Every enemy ship wey you destroy go give you 100 points (round numbers easy for players to calculate inside their head). The score go show for bottom left corner.
- **Life counter**: Your hero start with three lives - na standard wey early arcade games set to balance challenge and playability. Every time you crash with enemy, you lose one life. We go show the lives left for bottom right with ship icons ![life image](../../../../translated_images/life.6fb9f50d53ee0413.pcm.png).
## Make We Start Build!
First, arrange your workspace. Go your `your-work` sub folder. You supposed see these files:
```bash
-| assets
-| enemyShip.png
-| player.png
-| laserRed.png
-| index.html
-| app.js
-| package.json
```
To test your game, start the development server from the `your_work` folder:
```bash
cd your-work
npm start
```
Dis one go run local server for `http://localhost:5000`. Open dis address for your browser to see your game. Try the controls with arrow keys and try shoot enemy to confirm everything dey work.
```mermaid
flowchart TD
A["1. Asset Loading"] --> B["2. Game Variables"]
B --> C["3. Collision Detection"]
C --> D["4. Hero Enhancement"]
D --> E["5. Display Functions"]
E --> F["6. Event Handlers"]
G["Life Icon Image"] --> A
H["Score & Lives Tracking"] --> B
I["Hero-Enemy Intersections"] --> C
J["Points & Life Methods"] --> D
K["Text & Icon Rendering"] --> E
L["Reward & Penalty Logic"] --> F
F --> M["🎮 Complete Game"]
style A fill:#e3f2fd
style B fill:#e8f5e8
style C fill:#fff3e0
style D fill:#f3e5f5
style E fill:#e0f2f1
style F fill:#fce4ec
style M fill:#e1f5fe
```
### Time to Code!
1. **Collect the visual assets wey you need**. Copy the `life.png` asset from `solution/assets/` folder go your `your-work` folder. Then add the lifeImg to your window.onload function:
```javascript
lifeImg = await loadTexture("assets/life.png");
```
1. No forget to add the `lifeImg` to your assets list:
```javascript
let heroImg,
...
lifeImg,
...
eventEmitter = new EventEmitter();
```
2. **Setup your game variables**. Add code to track your total score (we start from 0) and lives wey remain (we start with 3). We go show dis for screen make players always sabi how e be.
3. **Implement collision detection**. Extend your `updateGameObjects()` function to find when enemy crash your hero:
```javascript
enemies.forEach(enemy => {
const heroRect = hero.rectFromGameObject();
if (intersectRect(heroRect, enemy.rectFromGameObject())) {
eventEmitter.emit(Messages.COLLISION_ENEMY_HERO, { enemy });
}
})
```
4. **Add life and point tracking to your Hero**.
1. **Start the counters**. Under `this.cooldown = 0` inside your `Hero` class, set life and points:
```javascript
this.life = 3;
this.points = 0;
```
1. **Show these values to player**. Make functions wey go draw these for screen:
```javascript
function drawLife() {
// TODO, 35, 27
const START_POS = canvas.width - 180;
for(let i=0; i < hero.life; i++ ) {
ctx.drawImage(
lifeImg,
START_POS + (45 * (i+1) ),
canvas.height - 37);
}
}
function drawPoints() {
ctx.font = "30px Arial";
ctx.fillStyle = "red";
ctx.textAlign = "left";
drawText("Points: " + hero.points, 10, canvas.height-20);
}
function drawText(message, x, y) {
ctx.fillText(message, x, y);
}
```
1. **Connect everything enter your game loop**. Add these functions to your window.onload function just after `updateGameObjects()`:
```javascript
drawPoints();
drawLife();
```
### 🔄 **Pedagogical Check-in**
**Game Design Understanding**: Before you put consequences, make sure you understand:
- ✅ How visual feedback dey tell players how game be
- ✅ Why to place UI elements same place dey help usability
- ✅ The mindset behind point values and managing life
- ✅ How canvas text drawing different from HTML text
**Quick Self-Test**: Why arcade games dey usually use round numbers for points?
*Answer: Round numbers easier for players calculate inside their head and e dey give satisfying psychological reward*
**User Experience Principles**: Now you dey apply:
- **Visual Hierarchy**: Important info dey show well
- **Immediate Feedback**: Player action dey update quick quick
- **Cognitive Load**: Simple, clear info presentation
- **Emotional Design**: Icons and colors wey connect player
1. **Implement game consequences and rewards**. Now we go add feedback systems wey make player actions get meaning:
1. **Collisions dey cost lives**. Anytime your hero jam enemy, you go lose one life.
Add this method to your `Hero` class:
```javascript
decrementLife() {
this.life--;
if (this.life === 0) {
this.dead = true;
}
}
```
2. **Shooting enemies dey give points**. Every hit wey land well go give 100 points, na quick positive feedback for good shooting.
Expand your Hero class with this increment method:
```javascript
incrementPoints() {
this.points += 100;
}
```
Now connect these functions to your collision events:
```javascript
eventEmitter.on(Messages.COLLISION_ENEMY_LASER, (_, { first, second }) => {
first.dead = true;
second.dead = true;
hero.incrementPoints();
})
eventEmitter.on(Messages.COLLISION_ENEMY_HERO, (_, { enemy }) => {
enemy.dead = true;
hero.decrementLife();
});
```
✅ You wan know other games wey JavaScript and Canvas dey build? Go explore - you go shock how e fit dey!
After you add these, test your game to see the complete feedback system dey work. You go see life icons for bottom right, score for bottom left, and watch as crash reduce lives and correct shoot increase your score.
Your game now get the main mechanics that make old arcade games fun - clear goals, immediate feedback, and consequences wey matter to player actions.
### 🔄 **Pedagogical Check-in**
**Complete Game Design System**: Check you sabi player feedback system well:
- ✅ How scoring mechanics dey create motivation and player engagement?
- ✅ Why visual consistency important for UI design?
- ✅ How life system balance challenge with player retention?
- ✅ Wetin immediate feedback dey do to make gameplay satisfy?
**System Integration**: Your feedback system dey show:
- **User Experience Design**: Clear visual info and hierarchy
- **Event-Driven Architecture**: Quick updates to player actions
- **State Management**: Track and show changing game data
- **Canvas Mastery**: Text drawing and sprite placement
- **Game Psychology**: Know player motivation and engagement
**Professional Patterns**: You don implement:
- **MVC Architecture**: Separate game logic, data, and presentation
- **Observer Pattern**: Event-driven updates for game state
- **Component Design**: Reusable functions for drawing and logic
- **Performance Optimization**: Efficient drawing for game loops
### ⚡ **Wetin You Fit Do for Next 5 Minutes**
- [ ] Try different font sizes and colors for the score display
- [ ] Try change point values and feel how e affect gameplay
- [ ] Add console.log to trace when points and lives change
- [ ] Test edge cases like when lives finish or you get high scores
### 🎯 **Wetin You Fit Do This Hour**
- [ ] Complete post-lesson quiz and understand game design psychology
- [ ] Add sound effects for scoring and losing lives
- [ ] Implement high score system using localStorage
- [ ] Add different point values for different enemy types
- [ ] Add visual effects like screen shake when life lose
### 📅 **Your One Week Game Design Journey**
- [ ] Complete full space game with solid feedback systems
- [ ] Add advanced scoring mechanics like combo multipliers
- [ ] Add achievements and unlockable content
- [ ] Create difficulty progression and balance systems
- [ ] Design user interfaces for menus and game over screens
- [ ] Study other games to understand engagement ways
### 🌟 **Your One Month Game Development Mastery**
- [ ] Build full games with complex progression systems
- [ ] Learn game analytics and player behavior measuring
- [ ] Contribute to open source game dev projects
- [ ] Master advanced game design patterns and monetization
- [ ] Make educational content about game design and user experience
- [ ] Build portfolio showing your game design and development skills
## 🎯 Your Game Design Mastery Timeline
```mermaid
timeline
title Game Design & Player Feedback Learning Progression
section Foundation (10 minutes)
Visual Communication: Text rendering
: Icon design
: Layout principles
: Color psychology
section Player Psychology (20 minutes)
Motivation Systems: Point values
: Risk vs reward
: Progress feedback
: Achievement design
section Technical Implementation (30 minutes)
Canvas Mastery: Text positioning
: Sprite rendering
: State management
: Performance optimization
section Game Balance (40 minutes)
Difficulty Design: Life management
: Scoring curves
: Player retention
: Accessibility
section User Experience (50 minutes)
Interface Design: Information hierarchy
: Responsive feedback
: Emotional design
: Usability testing
section Advanced Systems (1 week)
Game Mechanics: Progression systems
: Analytics integration
: Monetization design
: Community features
section Industry Skills (1 month)
Professional Development: Team collaboration
: Design documentation
: Player research
: Platform optimization
```
### 🛠️ Your Game Design Toolkit Summary
After this lesson, you don sabi:
- **Player Psychology**: Understanding motivation, risk/reward, engagement loops
- **Visual Communication**: Good UI design with text, icons, and layout
- **Feedback Systems**: Real-time reaction to player action and game events
- **State Management**: Track and show dynamic game data well
- **Canvas Text Rendering**: Professional text display with style and position
- **Event Integration**: Connect user action to real game consequences
- **Game Balance**: Design difficulty curve and player progression systems
**Real-World Applications**: Your game design skills fit:
- **User Interface Design**: Make engaging and easy interface
- **Product Development**: Understand user motivation and feedback loops
- **Educational Technology**: Gamification and learning systems
- **Data Visualization**: Make complex info simple and engaging
- **Mobile App Development**: Retention mechanics and UX design
- **Marketing Technology**: Understand user behavior and conversion optimize
**Professional Skills Gained**: You fit now:
- **Design** user experiences wey motivate and engage users
- **Implement** feedback systems wey guide user behavior well
- **Balance** challenge and accessibility for interactive systems
- **Create** visual communication wey work across user groups
- **Analyze** user behavior and improve design
**Game Development Concepts Mastered**:
- **Player Motivation**: Understanding wetin make player engage and stay
- **Visual Design**: Create clear, nice, and functional interface
- **System Integration**: Connect many game systems for one correct experience
- **Performance Optimization**: Efficient drawing and state management
- **Accessibility**: Design for all skill levels and player needs
**Next Level**: You fit waka go advanced game design patterns, put analytics systems, or learn game monetization and player retention strategies!
🌟 **Achievement Unlocked**: You don build solid player feedback system with professional game design principles!
---
## GitHub Copilot Agent Challenge 🚀
Use Agent mode to complete this challenge:
**Description:** Make your space game scoring system better by putting high score feature wey save in persistent storage plus bonus scoring mechanics.
**Prompt:** Create high score system wey save player best score to localStorage. Add bonus points for many enemy kill in row (combo system) and put different point values for different enemy types. Show visual sign when player get new high score and show current high score on game screen.
## 🚀 Challenge
Your game don dey work with scoring and lives. Think about wetin other features fit make player experience beta.
## Post-Lecture Quiz
[Post-lecture quiz](https://ff-quizzes.netlify.app/web/quiz/38)
## Review & Self Study
You wan explore more? Research different ways for game scoring and life systems. Plenty better game engines dey like [PlayFab](https://playfab.com) wey dey handle scoring, leaderboard, and player progress. How to put something like dat for your game go make am next level?
## Assignment
[Build a Scoring Game](assignment.md)
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document don translate wit AI translation service wey dem dey call [Co-op Translator](https://github.com/Azure/co-op-translator). Even though we dey try make am correct, abeg sabi say automatic translation fit get yawa or no correct well-well. The original document wey dem write for im own language na im be the correct one. If na important matter, e good make human wey sabi translate am well do am. We no go take any blame if pesin miss-understand or interpret am wrong because of this translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,27 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "81f292dbda01685b91735e0398dc0504",
"translation_date": "2026-01-08T14:14:03+00:00",
"source_file": "6-space-game/5-keeping-score/assignment.md",
"language_code": "pcm"
}
-->
# Build a Scoring Game
## Instructions
Create game wey go show life and points for one correct way. One idea na to show life as hearts and points as big number for the bottom center part of the screen. Check here for [Free game resources](https://www.kenney.nl/)
# Rubric
| Criteria | Exemplary | Adequate | Needs Improvement |
| -------- | ---------------------- | --------------------------- | -------------------------- |
| | full game is presented | game is partially presented | partial game contains bugs |
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document don translate wit AI translation service wey dem dey call [Co-op Translator](https://github.com/Azure/co-op-translator). Even though we try make am correct, abeg sabi say automated translations fit get some mistake or no too correct. The original document wey dey inside im ogbonge language na im be di correct source. If na serious matter, make person wey sabi translation translate am humanly. We no dey responsible for any wahala or wrong understanding wey fit come from di use of dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,17 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "068cbb9b3c10a96d503f6cdd6c9ace8c",
"translation_date": "2026-01-08T15:02:52+00:00",
"source_file": "6-space-game/5-keeping-score/solution/README.md",
"language_code": "pcm"
}
-->
Dis na placeholder, dem lef am blank on purpose.
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document don translate wit AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator). Even though we try make am correct, abeg sabi say automated translations fit get errors or wahala. The original document wey e dey for im own language na im be the correct one. If na serious matter, e good make human professional translate am. We no go take responsibility for any misunderstanding or wrong meaning wey fit come from dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,17 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "068cbb9b3c10a96d503f6cdd6c9ace8c",
"translation_date": "2026-01-08T15:02:05+00:00",
"source_file": "6-space-game/5-keeping-score/your-work/README.md",
"language_code": "pcm"
}
-->
Dis na placeholder, e lef blank on purpose.
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Warning**:
Dis document na AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator) wey dem use translate am. Even though we try to make am correct, abeg understand say automated translation fit get some mistake or no too correct. The original document wey dem write for the original language na the correct one. If na serious information, better make professional human translation do am. We no go bear any yawa wey fit happen because of how you take use dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,684 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "a4b78043f4d64bf3ee24e0689b8b391d",
"translation_date": "2026-01-08T13:49:10+00:00",
"source_file": "6-space-game/6-end-condition/README.md",
"language_code": "pcm"
}
-->
# Build a Space Game Part 6: End and Restart
```mermaid
journey
title Your Game Completion Journey
section End Conditions
Define win/lose states: 3: Student
Implement condition checking: 4: Student
Handle state transitions: 4: Student
section Player Experience
Design feedback systems: 4: Student
Create restart mechanics: 5: Student
Polish user interface: 5: Student
section System Integration
Manage game lifecycle: 5: Student
Handle memory cleanup: 5: Student
Create complete experience: 5: Student
```
Every great game dey need clear end conditions and smooth restart mechanism. You don build correct space game wey get movement, combat, and scoring - now na time to add the last pieces wey go make am complete.
Your game dey run forever now, like the Voyager probes wey NASA launch for 1977 - still dey travel space even after many years. E good for space exploration but games need set endpoints to make the experience satisfy.
Today, we go implement correct win/lose conditions plus restart system. By end of this lesson, you go get polished game wey people fit complete and play again, just like classic arcade games wey define the medium.
```mermaid
mindmap
root((Game Completion))
End Conditions
Victory States
Defeat Conditions
Progress Tracking
State Validation
Player Feedback
Visual Messages
Color Psychology
Clear Communication
Emotional Response
State Management
Game Loop Control
Memory Cleanup
Object Lifecycle
Event Handling
Restart Systems
Input Handling
State Reset
Fresh Initialization
User Experience
Polish Elements
Message Display
Smooth Transitions
Error Prevention
Accessibility
```
## Pre-Lecture Quiz
[Pre-lecture quiz](https://ff-quizzes.netlify.app/web/quiz/39)
## Understanding Game End Conditions
When your game suppose end? Dis question na the foundation wey don shape game design since early arcade days. Pac-Man go end when ghosts catch you or you clear all dots, Space Invaders go end when aliens reach bottom or you destroy dem all.
As game creator, na you define how player go win or lose. For our space game, here na wetin dey proven to create engaging gameplay:
```mermaid
flowchart TD
A["🎮 Game Don Start"] --> B{"Check Conditions"}
B --> C["Enemy Count"]
B --> D["Hero Lives"]
B --> E["Score Threshold"]
B --> F["Level Progress"]
C --> C1{"Enemies = 0?"}
D --> D1{"Lives = 0?"}
E --> E1{"Score ≥ Target?"}
F --> F1{"Objectives Complete?"}
C1 -->|Yes| G["🏆 Victory"]
D1 -->|Yes| H["💀 Defeat"]
E1 -->|Yes| G
F1 -->|Yes| G
C1 -->|No| B
D1 -->|No| B
E1 -->|No| B
F1 -->|No| B
G --> I["🔄 Restart Option"]
H --> I
style G fill:#e8f5e8
style H fill:#ffebee
style I fill:#e3f2fd
```
- **`N` Enemy ships don destroy**: E common if you divide game into levels wey you need destroy `N` Enemy ships to finish one level
- **Your ship don destroy**: E get games wey you lose if your ship destroy. Another way na to get lives concept: every time your ship destroy, e go reduce one life. When all lives done, na lose game be dat.
- **You don collect `N` points**: Another common way to end game na to collect points. How you take gather points na your choice but e dey common to assign points for things like destroying enemy ships or collecting items wey dem drop after you destroy dem.
- **Complete one level**: Dis fit require many conditions like `X` enemy ships destroy, `Y` points collect or collect some specific item.
## Implementing Game Restart Functionality
Good games dey encourage make player play again through smooth restart methods. When player finish game (or lose), dem go want try again sharp-sharp - either to beat their score or do better.
```mermaid
stateDiagram-v2
[*] --> Playing: Game Start
Playing --> Victory: All enemies destroyed
Playing --> Defeat: Lives = 0
Victory --> MessageDisplay: Show win message
Defeat --> MessageDisplay: Show lose message
MessageDisplay --> WaitingRestart: Press Enter prompt
WaitingRestart --> Resetting: Enter key pressed
Resetting --> CleanupMemory: Clear intervals
CleanupMemory --> ClearEvents: Remove listeners
ClearEvents --> InitializeGame: Fresh start
InitializeGame --> Playing: New game begins
note right of MessageDisplay
Color-coded feedback:
Green = Victory
Red = Defeat
end note
note right of Resetting
Complete state reset
prevents memory leaks
end note
```
Tetris na example for dis well well: when blocks reach top, you fit begin new game anytime without go through complex menu. We go build similar restart system wey go clear game state well and make players quick enter action again.
**Reflection**: Think about games wey you don play. Under wetin conditions dem go end? How dem dey make you restart? Wetin make restart experience smooth or frustrating?
## Wetin You Go Build
You go add final features wey go turn your project to complete game experience. These things separate polished games from basic prototypes.
**Na wetin we dey add today:**
1. **Victory condition**: Blast all enemies then get correct celebration (you deserve am!)
2. **Defeat condition**: When life finish, face defeat screen
3. **Restart mechanism**: Press Enter to start again - one game no ever enough
4. **State management**: Clean start every time - no enemies wey remain or funny glitches from previous game
## Getting Started
Make we prepare your development environment. You suppose get all your space game files from previous lessons ready.
**Your project suppose look like dis:**
```bash
-| assets
-| enemyShip.png
-| player.png
-| laserRed.png
-| life.png
-| index.html
-| app.js
-| package.json
```
**Start your development server:**
```bash
cd your-work
npm start
```
**This command:**
- Dey run local server for `http://localhost:5000`
- Dey serve your files well well
- Automatically dey refresh anytime you make changes
Open `http://localhost:5000` for your browser and confirm say your game dey run. You suppose fit move, shoot and interact with enemies. Once you confirm am, we fit continue with implementation.
> 💡 **Pro Tip**: To avoid warnings for Visual Studio Code, declare `gameLoopId` for top of your file as `let gameLoopId;` instead of declaring am inside `window.onload`. Dis na better JavaScript variable declaration practice.
```mermaid
flowchart TD
A["1. Condition Tracking"] --> B["2. Event Handlers"]
B --> C["3. Message Constants"]
C --> D["4. Restart Controls"]
D --> E["5. Message Display"]
E --> F["6. Reset System"]
G["isHeroDead()\nisEnemiesDead()"] --> A
H["Collision Events\nEnd Game Events"] --> B
I["GAME_END_WIN\nGAME_END_LOSS"] --> C
J["Enter Key\nRestart Trigger"] --> D
K["Victory/Defeat\nColor-coded Text"] --> E
L["State Cleanup\nFresh Initialization"] --> F
F --> M["🎮 Complete Game"]
style A fill:#e3f2fd
style B fill:#e8f5e8
style C fill:#fff3e0
style D fill:#f3e5f5
style E fill:#e0f2f1
style F fill:#fce4ec
style M fill:#e1f5fe
```
## Implementation Steps
### Step 1: Create End Condition Tracking Functions
We need functions wey go dey watch when game suppose end. Like sensors for International Space Station wey dey monitor systems every time, these functions go dey check game state non stop.
```javascript
function isHeroDead() {
return hero.life <= 0;
}
function isEnemiesDead() {
const enemies = gameObjects.filter((go) => go.type === "Enemy" && !go.dead);
return enemies.length === 0;
}
```
**Na wetin dey happen for under the hood:**
- **Check** if our hero don finish life (ouch!)
- **Count** how many enemies still dey alive and dey fight
- **Return** `true` when battlefield clear of enemies
- **Use** simple true/false logic to keep am easy
- **Filter** through all game objects to find survivors
### Step 2: Update Event Handlers for End Conditions
Now we go connect these condition checks to game event system. Every time collision happen, game go check if na end condition. Dis one go create immediate feedback for important events.
```mermaid
sequenceDiagram
participant Collision
participant GameLogic
participant Conditions
participant EventSystem
participant Display
Collision->>GameLogic: Laser hit enemy
GameLogic->>GameLogic: Destroy objects
GameLogic->>Conditions: Check isEnemiesDead()
alt All di enemy don kpai
Conditions->>EventSystem: Emit GAME_END_WIN
EventSystem->>Display: Show victory message
else Still get enemy
Conditions->>GameLogic: Continue game
end
Collision->>GameLogic: Enemy hit hero
GameLogic->>GameLogic: Reduce lives
GameLogic->>Conditions: Check isHeroDead()
alt Lives = 0
Conditions->>EventSystem: Emit GAME_END_LOSS
EventSystem->>Display: Show defeat message
else Lives still dey
GameLogic->>Conditions: Check isEnemiesDead()
alt All di enemy don kpai
Conditions->>EventSystem: Emit GAME_END_WIN
end
end
```
```javascript
eventEmitter.on(Messages.COLLISION_ENEMY_LASER, (_, { first, second }) => {
first.dead = true;
second.dead = true;
hero.incrementPoints();
if (isEnemiesDead()) {
eventEmitter.emit(Messages.GAME_END_WIN);
}
});
eventEmitter.on(Messages.COLLISION_ENEMY_HERO, (_, { enemy }) => {
enemy.dead = true;
hero.decrementLife();
if (isHeroDead()) {
eventEmitter.emit(Messages.GAME_END_LOSS);
return; // los before win
}
if (isEnemiesDead()) {
eventEmitter.emit(Messages.GAME_END_WIN);
}
});
eventEmitter.on(Messages.GAME_END_WIN, () => {
endGame(true);
});
eventEmitter.on(Messages.GAME_END_LOSS, () => {
endGame(false);
});
```
**Na wetin dey happen here:**
- **Laser hit enemy**: both disappear, you gain points, and we check if you don win
- **Enemy hit you**: you lose life, and we check if you still dey alive
- **Smart ordering**: we check for defeat first (no one wan win and lose at same time!)
- **Instant reaction**: as soon as something important happen, game go sabi am
### Step 3: Add New Message Constants
You need add new message types to your `Messages` constant object. These constants dey help keep things consistent and avoid typing mistakes for your event system.
```javascript
GAME_END_LOSS: "GAME_END_LOSS",
GAME_END_WIN: "GAME_END_WIN",
```
**For the above, we:**
- **Add** constants for game end events to keep am consistent
- **Use** descriptive names wey clearly show wetin event mean
- **Follow** existing naming style for message types
### Step 4: Implement Restart Controls
Now you go add keyboard controls wey go let players restart game. Enter key na natural choice because e dey associated with confirming actions and starting new games.
**Add Enter key detection for your current keydown event listener:**
```javascript
else if(evt.key === "Enter") {
eventEmitter.emit(Messages.KEY_EVENT_ENTER);
}
```
**Add the new message constant:**
```javascript
KEY_EVENT_ENTER: "KEY_EVENT_ENTER",
```
**Wetin you need sabi:**
- **Extend** your existing keyboard event handling system
- **Use** Enter key as restart trigger for easy understanding
- **Emit** custom event wey other parts of game fit listen
- **Maintain** same pattern as other keyboard controls
### Step 5: Create the Message Display System
Your game need talk to players clearly. We go create message system wey go show victory and defeat states with colored text, like old computer terminals where green mean success and red mean error.
**Create `displayMessage()` function:**
```javascript
function displayMessage(message, color = "red") {
ctx.font = "30px Arial";
ctx.fillStyle = color;
ctx.textAlign = "center";
ctx.fillText(message, canvas.width / 2, canvas.height / 2);
}
```
**Step by step, na wetin dey happen:**
- **Set** font size and family for clear text
- **Apply** color parameter with "red" as default for warning
- **Center** text horizontal and vertical for canvas
- **Use** modern JavaScript default parameters for flexible colors
- **Leverage** canvas 2D context to directly draw text
**Create `endGame()` function:**
```javascript
function endGame(win) {
clearInterval(gameLoopId);
// Set delay make sure say any pending renders go complete
setTimeout(() => {
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.fillStyle = "black";
ctx.fillRect(0, 0, canvas.width, canvas.height);
if (win) {
displayMessage(
"Victory!!! Pew Pew... - Press [Enter] to start a new game Captain Pew Pew",
"green"
);
} else {
displayMessage(
"You died !!! Press [Enter] to start a new game Captain Pew Pew"
);
}
}, 200)
}
```
**Wetin this function dey do:**
- **Freeze** everything — no more moving ships or lasers
- **Pause small** (200ms) to let last frame draw finish
- **Clear** screen and paint am black for dramatic effect
- **Show** different messages for winners and losers
- **Color code** message - green for success, red for wahala
- **Tell** players how to jump back in
### 🔄 **Pedagogical Check-in**
**Game State Management**: Before you implement reset, make sure you understand:
- ✅ How end conditions create clear gameplay goals
- ✅ Why visual feedback important for player understanding
- ✅ Why proper cleanup dey prevent memory wahala
- ✅ How event-driven design allow clean state switches
**Quick Self-Test**: Wetin go happen if you no clear event listeners during reset?
*Answer: Memory leaks and double event handlers go cause waka we no fit predict*
**Game Design Principles**: You don implement:
- **Clear Goals**: Players sabi exactly when dem win or lose
- **Immediate Feedback**: Game state changes dey show sharp sharp
- **User Control**: Players fit restart anytime dem ready
- **System Reliability**: Proper cleanup stop bugs and improve performance
### Step 6: Implement Game Reset Functionality
Reset system need fully clear current game state and start new game session. This one go ensure clean start without old data from previous game.
**Create `resetGame()` function:**
```javascript
function resetGame() {
if (gameLoopId) {
clearInterval(gameLoopId);
eventEmitter.clear();
initGame();
gameLoopId = setInterval(() => {
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.fillStyle = "black";
ctx.fillRect(0, 0, canvas.width, canvas.height);
drawPoints();
drawLife();
updateGameObjects();
drawGameObjects(ctx);
}, 100);
}
}
```
**Make we understand each part:**
- **Check** if game loop dey run before reset
- **Clear** existing game loop to stop everything
- **Remove** all event listeners to avoid memory leaks
- **Reinitialize** game state with fresh objects and variables
- **Start** new game loop with important game functions
- **Use** 100ms interval for consistent game flow
**Add Enter key event handler to your `initGame()` function:**
```javascript
eventEmitter.on(Messages.KEY_EVENT_ENTER, () => {
resetGame();
});
```
**Add `clear()` method to your EventEmitter class:**
```javascript
clear() {
this.listeners = {};
}
```
**Key points to remember:**
- **Connect** Enter key press to reset game
- **Register** this listener during game init
- **Give** easy way to remove all listeners when resetting
- **Prevent** memory leaks by clearing handlers between games
- **Reset** listener object to empty for fresh start
## Congratulations! 🎉
👽 💥 🚀 You don build complete game from start to finish. Just like programmers wey create first video games for 1970s, you don turn code lines to interactive experience wey get correct game mechanics and user feedback. 🚀 💥 👽
**You don achieve:**
- **Implement** complete win and lose conditions with user feedback
- **Create** smooth restart system for continuous play
- **Design** clear visual communication for game states
- **Manage** complex state transitions and cleanup
- **Put together** all parts into one strong playable game
### 🔄 **Pedagogical Check-in**
**Complete Game Development System**: Celebrate your skill for full game development:
- ✅ How end conditions create satisfying player experience?
- ✅ Why correct state management dey critical for game stability?
- ✅ How visual feedback improve player understanding?
- ✅ Wetin restart system mean to player stay?
**System Mastery**: Your complete game show:
- **Full-Stack Game Development**: From graphics to input to state management
- **Professional Architecture**: Event-driven system with proper cleanup
- **User Experience Design**: Clear feedback and easy controls
- **Performance Optimization**: Efficient rendering and memory handling
- **Polish and Completion**: All details wey make game feel finished
**Industry-Ready Skills**: You don implement:
- **Game Loop Architecture**: Real-time system with steady performance
- **Event-Driven Programming**: Decoupled system wey fit scale well
- **State Management**: Complex data handling and lifecycle control
- **UI Design**: Clear communication and responsive input
- **Testing and Debugging**: Iterate and solve problems well
### ⚡ **Wetin You Fit Do for Next 5 Minutes**
- [ ] Play your full game and test all win and lose conditions
- [ ] Try different end condition parameters
- [ ] Add console.log statements to follow game state changes
- [ ] Share your game with friends and collect their feedback
### 🎯 **Wetin You Fit Achieve Dis Hour**
- [ ] Complete post-lesson quiz and reflect on game journey
- [ ] Add sound effects for win and lose states
- [ ] Implement extra end conditions like time limits or bonus goals
- [ ] Create different difficulty levels with more enemies
- [ ] Polish visuals with better fonts and colors
### 📅 **Your Week-Long Game Development Mastery**
- [ ] Complete enhanced space game with multiple levels and progress
- [ ] Add advanced features like power-ups, different enemies, special weapons
- [ ] Create high score system with persistent storage
- [ ] Design user interfaces for menus, settings, game options
- [ ] Optimize performance for different devices and browsers
- [ ] Deploy game online and share with community
### 🌟 **Your Month-Long Game Development Career**
- [ ] Build multiple complete games exploring different genres and mechanics
- [ ] Learn advanced game development frameworks like Phaser or Three.js
- [ ] Contribute to open source game development projects
- [ ] Study game design principles and player psychology
- [ ] Create a portfolio showcasing your game development skills
- [ ] Connect with the game development community and continue learning
## 🎯 Your Complete Game Development Mastery Timeline
```mermaid
timeline
title Complete Game Development Learning Progression
section Foundation (Lessons 1-2)
Game Architecture: Project structure
: Asset management
: Canvas basics
: Event systems
section Interaction Systems (Lessons 3-4)
Player Control: Input handling
: Movement mechanics
: Collision detection
: Physics simulation
section Game Mechanics (Lesson 5)
Feedback Systems: Scoring mechanisms
: Life management
: Visual communication
: Player motivation
section Game Completion (Lesson 6)
Polish & Flow: End conditions
: State management
: Restart systems
: User experience
section Advanced Features (1 week)
Enhancement Skills: Audio integration
: Visual effects
: Level progression
: Performance optimization
section Professional Development (1 month)
Industry Readiness: Framework mastery
: Team collaboration
: Portfolio development
: Community engagement
section Career Advancement (3 months)
Specialization: Advanced game engines
: Platform deployment
: Monetization strategies
: Industry networking
```
### 🛠️ Your Complete Game Development Toolkit Summary
After completing this entire space game series, you now don master:
- **Game Architecture**: Event-driven systems, game loops, and state management
- **Graphics Programming**: Canvas API, sprite rendering, and visual effects
- **Input Systems**: Keyboard handling, collision detection, and responsive controls
- **Game Design**: Player feedback, progression systems, and engagement mechanics
- **Performance Optimization**: Efficient rendering, memory management, and frame rate control
- **User Experience**: Clear communication, intuitive controls, and polish details
- **Professional Patterns**: Clean code, debugging techniques, and project organization
**Real-World Applications**: Your game development skills fit directly for:
- **Interactive Web Applications**: Dynamic interfaces and real-time systems
- **Data Visualization**: Animated charts and interactive graphics
- **Educational Technology**: Gamification and engaging learning experiences
- **Mobile Development**: Touch-based interactions and performance optimization
- **Simulation Software**: Physics engines and real-time modeling
- **Creative Industries**: Interactive art, entertainment, and digital experiences
**Professional Skills Gained**: You fit now:
- **Architect** complex interactive systems from scratch
- **Debug** real-time applications using systematic approaches
- **Optimize** performance for smooth user experiences
- **Design** engaging user interfaces and interaction patterns
- **Collaborate** well on technical projects with proper code organization
**Game Development Concepts Mastered**:
- **Real-time Systems**: Game loops, frame rate management, and performance
- **Event-Driven Architecture**: Decoupled systems and message passing
- **State Management**: Complex data handling and lifecycle management
- **User Interface Programming**: Canvas graphics and responsive design
- **Game Design Theory**: Player psychology and engagement mechanics
**Next Level**: You ready to test advanced game frameworks, 3D graphics, multiplayer systems, or move enter professional game development roles!
🌟 **Achievement Unlocked**: You don complete full game development journey and build professional-quality interactive experience from scratch!
**Welcome to the game development community!** 🎮✨
## GitHub Copilot Agent Challenge 🚀
Use the Agent mode to complete this challenge:
**Description:** Make the space game better by putting level progression system wey get increasing difficulty and bonus features.
**Prompt:** Build multi-level space game system wey every level get more enemy ships wey dey faster and get more health. Add scoring multiplier wey dey increase with each level, also put power-ups (like rapid fire or shield) wey go randomly appear when enemies spoil. Add level completion bonus and show the current level for screen plus the score and lives wey dey already.
Learn more about [agent mode](https://code.visualstudio.com/blogs/2025/02/24/introducing-copilot-agent-mode) here.
## 🚀 Optional Enhancement Challenge
**Add Audio to Your Game**: Make your game better by adding sound effects! Think to add audio for:
- **Laser shots** wen player fire
- **Enemy destruction** wen ship dem chop
- **Hero damage** wen player dey hit
- **Victory music** wen player win game
- **Defeat sound** wen player lose game
**Audio implementation example:**
```javascript
// Make audio ogbonge objects
const laserSound = new Audio('assets/laser.wav');
const explosionSound = new Audio('assets/explosion.wav');
// Play sound dem wen game tins happen
function playLaserSound() {
laserSound.currentTime = 0; // Start from the beginning once again
laserSound.play();
}
```
**Wetyn you need sabi:**
- **Creates** Audio objects for different sound effects
- **Reset** di `currentTime` so that rapid-fire sound effects fit run quick
- **Handles** browser autoplay rules by making sounds come from user actions
- **Manages** audio volume and timing to make game experience better
> 💡 **Learning Resource**: Check dis [audio sandbox](https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_audio_play) to learn more how to put audio for JavaScript games.
## Post-Lecture Quiz
[Post-lecture quiz](https://ff-quizzes.netlify.app/web/quiz/40)
## Review & Self Study
Your assignment na to create fresh sample game, so go explore some interesting games wey dey so to see which kain game you fit build.
## Assignment
[Build a Sample Game](assignment.md)
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document don translate wit AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator). Even as we dey try make am correct, abeg sabi say automated translation fit get some errors or wahala. Di original document for dia own language na di correct one dem suppose trust. If na serious info, e better make professional human translation do am. We no go responsible if person misunderstand or comot wrong meaning from dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,173 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "232d592791465c1678cab3a2bb6cd3e8",
"translation_date": "2026-01-08T13:58:33+00:00",
"source_file": "6-space-game/6-end-condition/assignment.md",
"language_code": "pcm"
}
-->
# Build a Sample Game
## Assignment Overview
Now wey you don sabi how game go end and how restart dey work for your space game, na time to take these ideas do another new game. You go design and build your own game wey go show different ways wey game fit end and how restart go work.
Dis assignment go make you think well well about how to design game and also practice the technical skills wey you don learn. You go try different ways wey person fit win or lose, make player fit progress, and make the restart experience sweet.
## Project Requirements
### Core Game Features
Your game gats get these important things:
**End Condition Variety**: Make sure say game fit end for at least two different ways:
- **Point-based victory**: Player reach target score or collect special items
- **Life-based defeat**: Player lose all e lives or health points
- **Objective completion**: All enemies don die, or specific items don collect, or goals don achieve
- **Time-based**: Game end after certain time or timer reach zero
**Restart Functionality**:
- **Clear game state**: Remove all old game objects and reset variables
- **Reinitialize systems**: Start fresh with new player stats, enemies, and objectives
- **User-friendly controls**: Make instructions clear for how to restart the game
**Player Feedback**:
- **Victory messages**: Celebrate player achievement with better feedback
- **Defeat messages**: Give encouraging messages wey go make player wan play again
- **Progress indicators**: Show current score, lives, or objective status
### Game Ideas and Inspiration
Choose one game idea from these or create your own:
#### 1. Console Adventure Game
Make text-based adventure wey get fight mechanics:
```
Hero> Strikes with broadsword - orc takes 3p damage
Orc> Hits with club - hero takes 2p damage
Hero> Kicks - orc takes 1p damage
Game> Orc is defeated - Hero collects 2 coins
Game> ****No more monsters, you have conquered the evil fortress****
```
**Key features to implement:**
- **Turn-based combat** with different attack options
- **Health points** for both player and enemies
- **Inventory system** for collecting coins or items
- **Multiple enemy types** with different difficulty levels
- **Victory condition** when all enemies done kill
#### 2. Collection Game
- **Objective**: Collect specific items and avoid obstacles
- **End conditions**: Reach the collection target or lose all your lives
- **Progression**: Items go dey harder to reach as game dey go
#### 3. Puzzle Game
- **Objective**: Solve puzzles wey go dey harder every level
- **End conditions**: Finish all levels or run out of moves/time
- **Restart**: Reset go first level with everything cleared
#### 4. Defense Game
- **Objective**: Protect your base from waves of enemies
- **End conditions**: Survive all waves (win) or base get destroy (lose)
- **Progression**: Enemy waves go harder and more
## Implementation Guidelines
### Getting Started
1. **Plan your game design**:
- Sketch the basic gameplay loop
- Define your end conditions clearly
- Know which data gats reset when you restart
2. **Set up your project structure**:
```
my-game/
├── index.html
├── style.css
├── game.js
└── README.md
```
3. **Create your core game loop**:
- Initialize game state
- Handle user input
- Update game logic
- Check end conditions
- Render current state
### Technical Requirements
**Use Modern JavaScript**:
- Use `const` and `let` for variable declarations
- Use arrow functions where e go fit
- Use ES6+ features like template literals and destructuring
**Event-Driven Architecture**:
- Create event handlers for user actions
- Change game state through events
- Use event listeners for restart functionality
**Clean Code Practices**:
- Write functions with one responsibility
- Use clear variable and function names
- Add comments wey explain game logic and rules
- Organize code in proper sections
## Submission Requirements
### Deliverables
1. **Complete game files**: All HTML, CSS, and JavaScript files wey you need to run your game
2. **README.md**: Documentation wey explain:
- How to play your game
- The end conditions you put for the game
- Instructions for restarting
- Any special features or game mechanics
3. **Code comments**: Clear explanations of your game logic and algorithms
### Testing Checklist
Before you submit, make sure say your game:
- [ ] **Runs without errors** inside the browser console
- [ ] **Implements multiple end conditions** as the assignment talk
- [ ] **Restarts properly** with clean reset state
- [ ] **Provides clear feedback** to players about game status
- [ ] **Uses modern JavaScript** syntax and good practices
- [ ] **Includes complete documentation** for README.md
## Assessment Rubric
| Criteria | Exemplary (4) | Proficient (3) | Developing (2) | Beginning (1) |
|----------|---------------|----------------|----------------|--------------|
| **Game Functionality** | Complete game wey get plenty end conditions, smooth restart, and polished gameplay | Full game with basic end conditions and working restart | Partial game with some end conditions, restart get small wahala | Incomplete game with limited functionality and big bugs |
| **Code Quality** | Clean, well-organized code using modern JavaScript, good comments, and excellent structure | Good code organization with modern syntax and enough comments | Basic code organization with some modern practices and little comments | Poor code organization, old syntax, missing comments and structure |
| **User Experience** | Gameplay easy to use with clear instructions, good feedback, and nice end/restart vibe | Good gameplay with enough instructions and feedback, working end/restart | Basic gameplay with few instructions and little feedback | Confusing gameplay with bad instructions and poor user feedback |
| **Technical Implementation** | Shows clear skill for game development concepts, event handling, and state management | Shows good understanding of game concepts with correct implementation | Basic understanding with okay implementation | Poor understanding with bad implementation |
| **Documentation** | Complete README with clear instructions, well commented code, and thorough tests | Good documentation with clear instructions and enough comments | Basic documentation with few instructions | Poor or missing documentation |
### Grading Scale
- **Exemplary (16-20 points)**: Passes better than expected with creative features and neat implementation
- **Proficient (12-15 points)**: Meets all requirements with solid work
- **Developing (8-11 points)**: Meets most requirements but get small issues
- **Beginning (4-7 points)**: Meet some things but need plenty improvement
## Additional Learning Resources
- [MDN Game Development Guide](https://developer.mozilla.org/en-US/docs/Games)
- [JavaScript Game Development Tutorials](https://developer.mozilla.org/en-US/docs/Games/Tutorials)
- [Canvas API Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API)
- [Game Design Principles](https://www.gamasutra.com/blogs/)
> 💡 **Pro Tip**: Start simple and add features small small. A well-polished simple game better pass complex game wey get plenty bugs!
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Warning**:
Dis document dem translate am wit AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator). Even though we try make e accurate, abeg sabi say automated translation fit get errors or wahala. Di original document for im own language na di correct source. If na serious tin you dey find, better make person wey sabi do professional human translation do am. We no go be responsible if person no understand or misinterpret anything wey come from dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,17 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "068cbb9b3c10a96d503f6cdd6c9ace8c",
"translation_date": "2026-01-08T15:01:19+00:00",
"source_file": "6-space-game/6-end-condition/solution/README.md",
"language_code": "pcm"
}
-->
Dis na placeholder, e lef blank on purpose.
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document don translate wit AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator). Even tho we try make am correct, abeg sabi say automated translation fit get some errors or mistakes. Di original document for im own language na di correct one wey you suppose trust. If na important tori, better make person wey sabi translate am do am. We no go responsible for any misunderstanding or wahala wey fit show because of dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,17 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "068cbb9b3c10a96d503f6cdd6c9ace8c",
"translation_date": "2026-01-08T15:00:29+00:00",
"source_file": "6-space-game/6-end-condition/your-work/README.md",
"language_code": "pcm"
}
-->
Dis na placeholder, dem lef am blank on purpose.
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Wetin I go talk first**:
Dis document na translation wey AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator) do. Even though we try make am correct, abeg note say machine translation fit get mistake or no too correct well. Di original document for im original language na di correct source. If e important well well, e better make person wey sabi do proper human translation do am. We no go take any wahala if person no understand well or mistake come because of dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,47 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "c40a698395ee5102715f7880bba3f2e7",
"translation_date": "2026-01-08T11:09:40+00:00",
"source_file": "6-space-game/README.md",
"language_code": "pcm"
}
-->
# Build a Space Game
Space game wey go teach una more advanced JavaScript fundamentals
For dis lesson, you go learn how to build your own space game. If you don ever play di game "Space Invaders", dis game get di same idea: to control spaceship and shoot monsters wey dey come down from above. Dis na wetin di finished game go be like:
![Finished game](../../../6-space-game/images/pewpew.gif)
For dis six lessons, you go learn di following:
- **Interact** with di Canvas element to draw things for screen
- **Understand** di cartesian coordinate system
- **Learn** di Pub-Sub pattern to create sound game architecture wey go easy to maintain and extend
- **Leverage** Async/Await to load game resources
- **Handle** keyboard events
## Overview
- Theory
- [Introduction to building games with JavaScript](1-introduction/README.md)
- Practice
- [Drawing to canvas](2-drawing-to-canvas/README.md)
- [Moving elements around the screen](3-moving-elements-around/README.md)
- [Collision detection](4-collision-detection/README.md)
- [Keeping score](5-keeping-score/README.md)
- [Ending and restarting the game](6-end-condition/README.md)
## Credits
Di assets wey dem use for dis na from https://www.kenney.nl/.
If you dey interested for building games, dem get fine assets, plenty free and some na paid.
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document don translate wit AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator). Even though we dey try make am correct, abeg sabi say automated translation fit get some mistakes or no too correct. Di original document wey dey di original language na di correct one to trust. If na important thing, e better make human professional translate am. We no go responsible if person no understand well or mix tori because of this translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,17 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "068cbb9b3c10a96d503f6cdd6c9ace8c",
"translation_date": "2026-01-08T14:36:15+00:00",
"source_file": "6-space-game/solution/README.md",
"language_code": "pcm"
}
-->
Dis na placeholder, left blank on purpose.
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document don translate wit AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator). Even tho we dey try make am correct, abeg sabi say automatic translations fit get mistake or small error. Di original document wey e come from e proper language na di correct one. If na serious mata, better make human professional translate am. We no go responsible for any misunderstanding or wrong meaning wey fit happen because of dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,832 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "351678bece18f07d9daa987a881fb062",
"translation_date": "2026-01-08T16:40:22+00:00",
"source_file": "7-bank-project/1-template-route/README.md",
"language_code": "pcm"
}
-->
# Build a Banking App Part 1: HTML Templates and Routes in a Web App
```mermaid
journey
title Your Banking App Development Journey
section SPA Fundamentals
Understand single-page apps: 3: Student
Learn template concepts: 4: Student
Master DOM manipulation: 4: Student
section Routing Systems
Implement client-side routing: 4: Student
Handle browser history: 5: Student
Create navigation systems: 5: Student
section Professional Patterns
Build modular architecture: 5: Student
Apply best practices: 5: Student
Create user experiences: 5: Student
```
When Apollo 11's guidance computer navigated to the moon in 1969, e bin gats switch between different programs without restarting the entire system. Modern web applications dey work similarly dem dey change wetin you dey see without reloading everything from scratch. Dis one dey create the smooth, responsive experience wey users dey expect nowadays.
Unlike traditional websites wey dey reload whole pages for every interaction, modern web apps dey update only the parts wey need to change. Dis method, like how mission control dey switch between different displays while still dey communicate, e dey create that fluid experience we don dey expect.
Na wetin make di difference so big:
| Traditional Multi-Page Apps | Modern Single-Page Apps |
|----------------------------|-------------------------|
| **Navigation** | Full page reload for each screen | Instant content switching |
| **Performance** | Slower due to complete HTML downloads | Faster with partial updates |
| **User Experience** | Jarring page flashes | Smooth, app-like transitions |
| **Data Sharing** | Difficult between pages | Easy state management |
| **Development** | Multiple HTML files to maintain | Single HTML with dynamic templates |
**Understanding the evolution:**
- **Traditional apps** need server requests for every navigation action
- **Modern SPAs** load once and update content dynamically using JavaScript
- **User expectations** now dey favour instant, smooth interactions
- **Performance benefits** dey include less bandwidth usage and faster responses
For this lesson, we go build a banking app wey get many screens wey dey flow well together. Like how scientists dey use modular instruments wey you fit reconfigure for different experiments, we go use HTML templates as reusable components wey fit show anytime we need am.
You go work with HTML templates (reusable blueprints for different screens), JavaScript routing (the system wey dey switch between screens), and the browser's history API (wey keep the back button dey work as e suppose). Dem na the same important methods wey frameworks like React, Vue, and Angular use.
By the end, you go get a working banking app wey show professional single-page application principles.
```mermaid
mindmap
root((Single-Page Applications))
Architecture
Template System
Client-side Routing
State Management
Event Handling
Templates
Reusable Components
Dynamic Content
DOM Manipulation
Content Switching
Routing
URL Management
History API
Navigation Logic
Browser Integration
User Experience
Fast Navigation
Smooth Transitions
Consistent State
Modern Interactions
Performance
Reduced Server Requests
Faster Page Transitions
Efficient Resource Usage
Better Responsiveness
```
## Pre-Lecture Quiz
[Pre-lecture quiz](https://ff-quizzes.netlify.app/web/quiz/41)
### Wetin You Go Need
We go need local web server to test our banking app no worry, e easy pass as e sound! If you never set am up before, just install [Node.js](https://nodejs.org) and run `npx lite-server` from your project folder. Dis command go start local server and open your app for browser automatically.
### Preparation
For your computer, create folder wey dem go call `bank` put inside am file wey get name `index.html`. We go start from dis HTML [boilerplate](https://en.wikipedia.org/wiki/Boilerplate_code):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Bank App</title>
</head>
<body>
<!-- This is where you'll work -->
</body>
</html>
```
**Wetin dis boilerplate dey provide:**
- **Establishes** the HTML5 document structure with proper DOCTYPE declaration
- **Configures** character encoding as UTF-8 for international text support
- **Enables** responsive design with the viewport meta tag for mobile compatibility
- **Sets** a descriptive title wey go show for browser tab
- **Creates** clean body section wey we go take build our application
> 📁 **Project Structure Preview**
>
> **By the end of this lesson, your project go get:**
> ```
> bank/
> ├── index.html <!-- Main HTML with templates -->
> ├── app.js <!-- Routing and navigation logic -->
> └── style.css <!-- (Optional for future lessons) -->
> ```
>
> **File responsibilities:**
> - **index.html**: Get all templates and app structure
> - **app.js**: E dey handle routing, navigation, and template management
> - **Templates**: Na UI for login, dashboard, and other screens
---
## HTML Templates
Templates dey solve one basic problem for web development. When Gutenberg invent movable type printing for 1440s, e realize say instead make e carve full pages, e fit create reusable letter blocks and arrange dem as e want. HTML templates dey work like dat instead of creating separate HTML files for each screen, you go define reusable structures wey you fit show anytime you need am.
```mermaid
flowchart TD
A["📋 Templet Definshon"] --> B["💬 Hid en DOM"]
B --> C["🔍 JavaScript Dey Find Templet"]
C --> D["📋 Klon Templet Kontent"]
D --> E["🔗 Atach to We Dey Visible DOM"]
E --> F["👁️ Yusae Dey See Kontent"]
G["Login Templet"] --> A
H["Dashboard Templet"] --> A
I["Futura Templet"] --> A
style A fill:#e3f2fd
style D fill:#e8f5e8
style F fill:#fff3e0
style B fill:#f3e5f5
```
Think templates as blueprint for different parts of your app. Like architect wey create one blueprint and use am many times instead of drawing exact rooms again and again, we dey create templates once and e go show anytime we need am. The browser dey hide these templates until JavaScript use am activate dem.
If you want make web page get many screens, one way na to create one HTML file for every screen you want show. But dis one get small wahala:
- You go gats reload full HTML anytime you change screen, e fit slow.
- E hard to share data between the different screens.
Another way na to get only one HTML file, and define many [HTML templates](https://developer.mozilla.org/docs/Web/HTML/Element/template) using the `<template>` element. Template na reusable HTML block wey browser no dey show by default, you go gats activate am with JavaScript during runtime.
### Make We Build Am
We go create bank app wey get two main screens: login page and dashboard. First, make we add placeholder element for our HTML body na here all our different screens go show:
```html
<div id="app">Loading...</div>
```
**Understanding dis placeholder:**
- **Creates** container with ID "app" where all screens go show
- **Show** loading message until JavaScript start first screen
- **Provide** one single mounting point for dynamic content
- **Allow** JavaScript to target am easily using `document.getElementById()`
> 💡 **Pro Tip**: Because dis element content go change, we fit put loading message or indicator wey go show while app dey load.
Next, make we add below HTML template for login page. For now we go put only title and section wey get link wey we go use do navigation.
```html
<template id="login">
<h1>Bank App</h1>
<section>
<a href="/dashboard">Login</a>
</section>
</template>
```
**Breaking down dis login template:**
- **Defines** template with unique ID "login" for JavaScript to target
- **Includes** main heading wey dey establish app branding
- **Get** semantic `<section>` element to group related items
- **Provide** navigation link wey go carry user go dashboard
Then we go add another HTML template for dashboard page. Dis page go get different sections:
- Header wey get title and logout link
- Current bank account balance
- List of transactions, shown for table
```html
<template id="dashboard">
<header>
<h1>Bank App</h1>
<a href="/login">Logout</a>
</header>
<section>
Balance: 100$
</section>
<section>
<h2>Transactions</h2>
<table>
<thead>
<tr>
<th>Date</th>
<th>Object</th>
<th>Amount</th>
</tr>
</thead>
<tbody></tbody>
</table>
</section>
</template>
```
**Make we understand each part of dis dashboard:**
- **Structure** page with semantic `<header>` element wey get navigation
- **Show** app title steady for all screens to maintain branding
- **Provide** logout link wey go take user back to login screen
- **Show** current account balance for special section
- **Arrange** transaction data using proper HTML table
- **Define** table headers for Date, Object, and Amount columns
- **Leave** table body empty so we fit add content dynamically later
> 💡 **Pro Tip**: When you dey create HTML templates, if you want check how e go look, you fit comment out `<template>` and `</template>` line by enclosing dem inside `<!-- -->`.
### 🔄 **Pedagogical Check-in**
**Template System Understanding**: Before you write JavaScript, make sure say you understand:
- ✅ How templates dey different from normal HTML elements
- ✅ Why templates dey hidden until JavaScript activate dem
- ✅ How semantic HTML structure dey important inside templates
- ✅ How templates dey enable reusable UI components
**Quick Self-Test**: Wetin go happen if you remove `<template>` tags from your HTML?
*Answer: The content go show immediately and e no go behave like template again*
**Architecture Benefits**: Templates dey provide:
- **Reusability**: One definition, many instances
- **Performance**: No need repeat HTML parsing
- **Maintainability**: UI structure dey centralized
- **Flexibility**: Content fit change dynamically
✅ Why you think say we dey use `id` attributes for templates? We fit use classes instead?
## Bring Templates to Life with JavaScript
Now we need make our templates dey work. Like how 3D printer dey take digital blueprint kon create physical object, JavaScript dey take our hidden templates and create visible, interactive elements wey users fit see and use.
The process get three steady steps wey form foundation of modern web development. When you understand dis pattern, you go see am for many different frameworks and libraries.
If you try open your current HTML file for browser, you go see say e go just dey show `Loading...` forever. Na because we need add JavaScript code to instantiate and show HTML templates.
To instantiate template dey follow these 3 steps:
1. Find the template element in the DOM, example na [`document.getElementById`](https://developer.mozilla.org/docs/Web/API/Document/getElementById).
2. Clone the template element using [`cloneNode`](https://developer.mozilla.org/docs/Web/API/Node/cloneNode).
3. Attach the cloned content to the DOM inside a visible element, example na [`appendChild`](https://developer.mozilla.org/docs/Web/API/Node/appendChild).
```mermaid
flowchart TD
A[🔍 Step 1: Find Template] --> B[📋 Step 2: Clone Template]
B --> C[🔗 Step 3: Attach to DOM]
A1["document.getElementById('login')"] --> A
B1["template.content.cloneNode(true)"] --> B
C1["app.appendChild(view)"] --> C
C --> D[👁️ Template Wey User Fit See]
style A fill:#e1f5fe
style B fill:#f3e5f5
style C fill:#e8f5e8
style D fill:#fff3e0
```
**Visual breakdown of the process:**
- **Step 1** find the hidden template inside DOM structure
- **Step 2** create working copy wey you fit change safely
- **Step 3** put the copy for visible page area
- **Result** na functional screen wey users fit interact with
✅ Why we need clone template before we attach am for DOM? Wetin fit happen if we skip this step?
### Task
Create new file wey dem go call `app.js` for your project folder then import am for `<head>` section of your HTML:
```html
<script src="app.js" defer></script>
```
**Understanding dis script import:**
- **Link** JavaScript file to our HTML document
- **Use** `defer` attribute so script run after HTML parsing finish
- **Enable** access to all DOM elements because dem go fully load before script run
- **Follow** modern best practices for script loading and performance
Now for `app.js`, we go create new function wey dem go call `updateRoute`:
```js
function updateRoute(templateId) {
const template = document.getElementById(templateId);
const view = template.content.cloneNode(true);
const app = document.getElementById('app');
app.innerHTML = '';
app.appendChild(view);
}
```
**Step by step, wetin dey happen be:**
- **Find** template element using e unique ID
- **Create** deep copy of template content using `cloneNode(true)`
- **Find** the app container where content go show
- **Clear** any content wey dey inside app container
- **Put** cloned template content inside visible DOM
Now call dis function with one of the templates and look wetin happen.
```js
updateRoute('login');
```
**Wetin dis function call dey do:**
- **Activate** login template by passing its ID as parameter
- **Show** how to switch between different app screens programmatically
- **Show** login screen instead of "Loading..." message
✅ Why e dey important to do `app.innerHTML = '';`? Wetin go happen without am?
## Create Routes
Routing na to connect URLs to the correct content. Think how old telephone operators use switchboards to connect calls dem go take incoming request and route am to correct destination. Web routing dey work the same way, e go take URL request and decide which content to show.
```mermaid
flowchart LR
A["🌐 URL Path<br/>/dashboard"] --> B["🗺️ Routes Object<br/>Lookup"]
B --> C["🎯 Template ID<br/>'dashboard'"]
C --> D["📌 Find Template<br/>getElementById"]
D --> E["👁️ Show Screen<br/>Clone & Append"]
F["📍 /login"] --> G["🎯 'login'"]
H["📍 /unknown"] --> I["❌ No Find"]
I --> J["🔄 Redirect go /login"]
style B fill:#e3f2fd
style E fill:#e8f5e8
style I fill:#ffebee
style J fill:#fff3e0
```
Traditionally, web servers go serve different HTML files for different URLs. Since we dey build single-page app, we need handle the routing ourselves with JavaScript. Dis way go give us better control over user experience and performance.
```mermaid
flowchart LR
A["🌐 URL Path<br/>/dashboard"] --> B["🗺️ Routes Object<br/>Look up"]
B --> C["🎯 Template ID<br/>'dashboard'"]
C --> D["📄 Find Template<br/>getElementById"]
D --> E["👁️ Show Screen<br/>Clone & Append"]
F["📍 /login"] --> G["🎯 'login'"]
H["📍 /unknown"] --> I["❌ No Find"]
I --> J["🔄 Redirect go /login"]
style B fill:#e3f2fd
style E fill:#e8f5e8
style I fill:#ffebee
style J fill:#fff3e0
```
**Understanding routing flow:**
- **URL changes** dey make us look for route inside our configuration
- **Valid routes** go map to specific template IDs for rendering
- **Invalid routes** go trigger fallback behavior to avoid broken UI
- **Template rendering** follow the three-step process wey we learn before
When we talk about web app, *Routing* mean to map **URLs** to specific screens wey go show. For website with many HTML files, dis one go happen automatically because file paths dey reflect for URL. For example, if these files dey your project folder:
```
mywebsite/index.html
mywebsite/login.html
mywebsite/admin/index.html
```
If you create web server with `mywebsite` as root, URL mapping go be:
```
https://site.com --> mywebsite/index.html
https://site.com/login.html --> mywebsite/login.html
https://site.com/admin/ --> mywebsite/admin/index.html
```
But for our web app we dey use single HTML file wey get all screens, this default behaviour no go help us. We gats create this map by ourselves and update the displayed template using JavaScript.
### Task
We go use simple object that go implement [map](https://en.wikipedia.org/wiki/Associative_array) between URL paths and our templates. Add this object for the top of your `app.js` file.
```js
const routes = {
'/login': { templateId: 'login' },
'/dashboard': { templateId: 'dashboard' },
};
```
**Understanding dis routes configuration:**
- **Defines** mapping between URL paths and template identifiers
- **Use** object syntax where keys na URL paths and values get template info
- **Makes** e easy to lookup which template to display for any URL
- **Provide** structure wey fit grow well for adding new routes later on
Now mek we modify small di `updateRoute` function. Instead of just passing di `templateId` as argument, we wan first find am by looking di current URL, then we go use our map to get di template ID wey match am. We fit use [`window.location.pathname`](https://developer.mozilla.org/docs/Web/API/Location/pathname) to get only di path part for di URL.
```js
function updateRoute() {
const path = window.location.pathname;
const route = routes[path];
const template = document.getElementById(route.templateId);
const view = template.content.cloneNode(true);
const app = document.getElementById('app');
app.innerHTML = '';
app.appendChild(view);
}
```
**Break down wetin dey happen here:**
- **Extracts** di current path from di browser URL using `window.location.pathname`
- **Look up** di correct route configuration inside our routes object
- **Fetch** di template ID from di route configuration
- **Follow** di same template rendering process as before
- **Create** one dynamic system wey dey respond to URL changes
Here we don map di routes we declare to di correct template. You fit test am say e dey work well by changing di URL manually for your browser.
✅ Wetin go happen if you enter wrong path for di URL? How we fit solve am?
## Adding Navigation
With routing don set, users need one way to waka through di app. Normal websites dey reload whole pages when dem click for links, but we want update both di URL and content without page refresh. Dis one go create smoother experience like how desktop apps dey switch between different views.
We need coordinate two tins: update di browser URL so users fit bookmark pages and share links, and show correct content. If we do am correct, e go give di smooth navigation wey users dey expect from modern apps.
```mermaid
sequenceDiagram
participant User
participant Browser
participant App
participant Template
User->>Browser: Clicks "Login" link
Browser->>App: onclick event triggered
App->>App: preventDefault() & navigate('/dashboard')
App->>Browser: history.pushState('/dashboard')
Browser->>Browser: URL updates to /dashboard
App->>App: updateRoute() called
App->>Template: Find & clone dashboard template
Template->>App: Return cloned content
App->>Browser: Replace app content with template
Browser->>User: Display dashboard screen
Note over User,Template: User clicks browser back button
User->>Browser: Clicks back button
Browser->>Browser: History moves back to /login
Browser->>App: popstate event fired
App->>App: updateRoute() called automatically
App->>Template: Find & clone login template
Template->>App: Return cloned content
App->>Browser: Replace app content with template
Browser->>User: Display login screen
```
### 🔄 **Pedagogical Check-in**
**Single-Page Application Architecture**: Check your understanding of di complete system:
- ✅ How client-side routing different from traditional server-side routing?
- ✅ Why History API important for correct SPA navigation?
- ✅ How templates dey enable dynamic content without page reload?
- ✅ Wetin event handling role be for intercepting navigation?
**System Integration**: Your SPA dey show:
- **Template Management**: Reusable UI parts with dynamic content
- **Client-side Routing**: URL control without server request
- **Event-driven Architecture**: Responsive navigation and user action
- **Browser Integration**: Proper history plus back/forward button support
- **Performance Optimization**: Fast switches and less server load
**Professional Patterns**: You don implement:
- **Model-View Separation**: Templates separate from app logic
- **State Management**: URL state synchronized with shown content
- **Progressive Enhancement**: JavaScript dey upgrade basic HTML function
- **User Experience**: Smooth, app-like navigation without page reload
> <20> **Architecture Insight**: Navigation System Components
>
> **Wetin you dey build:**
> - **🔄 URL Management**: Updates browser address bar without page reload
> - **📋 Template System**: Swap content dynamically by current route
> - **📚 History Integration**: Keep browser back/forward button dey work
> - **🛡️ Error Handling**: Graceful fallback for wrong or missing routes
>
> **How components dey work together:**
> - **Listen** for navigation events (clicks, history changes)
> - **Update** di URL using History API
> - **Render** correct template for di new route
> - **Keep** smooth user experience throughout
Di next step for our app na to add ability to waka between pages without anybody change di URL manually. This mean two things:
1. Update di current URL
2. Update di shown template based on di new URL
We don already handle di second part with di `updateRoute` function, so na how we go update di current URL remain.
We go use JavaScript and specially [`history.pushState`](https://developer.mozilla.org/docs/Web/API/History/pushState) wey fit update URL and create new entry for browsing history, without reloading di HTML.
> ⚠️ **Important Note**: Even though di HTML anchor element [`<a href>`](https://developer.mozilla.org/docs/Web/HTML/Element/a) fit dey used alone to create hyperlinks to other URLs, e go make browser reload di HTML by default. E dey necessary to stop dis behavior when you dey handle routing with custom javascript, by using preventDefault() function on di click event.
### Task
Make we create new function wey we fit use to navigate for our app:
```js
function navigate(path) {
window.history.pushState({}, path, path);
updateRoute();
}
```
**Understand this navigation function:**
- **Update** di browser URL to new path using `history.pushState`
- **Add** new entry to browser history stack so back/forward buttons go work
- **Trigger** di `updateRoute()` function to show correct template
- **Keep** di single-page app experience without page reload
Dis method first update di current URL base on di path wey you give, then e update di template. Di property `window.location.origin` dey give di URL root, so we fit use am build complete URL from path.
Now we get this function, we fit handle di problem we get if path no match any defined route. We go modify di `updateRoute` function by adding fallback to one of di existing routes if we no fit find match.
```js
function updateRoute() {
const path = window.location.pathname;
const route = routes[path];
if (!route) {
return navigate('/login');
}
const template = document.getElementById(route.templateId);
const view = template.content.cloneNode(true);
const app = document.getElementById('app');
app.innerHTML = '';
app.appendChild(view);
}
```
**Key tins to remember:**
- **Check** if route dey for current path
- **Redirect** go login page if invalid route dey accessed
- **Provide** fallback method to stop broken navigation
- **Ensure** say users always dey see valid screen, even if URL wrong
If route no fit find, now we go redirect to `login` page.
Now make we create function to get di URL when dem click link, and to stop di browser default link behavior:
```js
function onLinkClick(event) {
event.preventDefault();
navigate(event.target.href);
}
```
**Break down dis click handler:**
- **Stop** di browser default link behavior using `preventDefault()`
- **Extract** di destination URL from di clicked link
- **Call** our custom navigate function instead of reloading da page
- **Keep** di smooth single-page app experience
```html
<a href="/dashboard" onclick="onLinkClick(event)">Login</a>
...
<a href="/login" onclick="onLinkClick(event)">Logout</a>
```
**Wetyn dis onclick na im do:**
- **Connect** every link to our custom navigation system
- **Pass** di click event to our `onLinkClick` function so e fit process am
- **Enable** smooth navigation without page reload
- **Keep** correct URL structure so users fit bookmark or share am
Di [`onclick`](https://developer.mozilla.org/docs/Web/API/GlobalEventHandlers/onclick) attribute dey bind di `click` event to JavaScript code, here e call di `navigate()` function.
Try click on these links, you suppose now fit waka between different screens for your app.
✅ Di `history.pushState` method na part of HTML5 standard and e dey inside [all modern browsers](https://caniuse.com/?search=pushState). If you dey build web app for old browsers, one trick you fit use instead of dis API be say: use [hash (`#`)](https://en.wikipedia.org/wiki/URI_fragment) before di path you fit continue to do routing wey go work with normal anchor navigation and no reload di page, because e suppose create internal links inside one page.
## Make Di Back and Forward Buttons Work
Back and forward buttons important well for web browsing, like how NASA mission controllers fit dey check previous system status during space missions. Users expect these buttons to work, and if dem no work, e go spoil di expected browsing experience.
Our single-page app need extra configuration to support dis. The browser get one history stack (wey we dey add to with `history.pushState`), but if users waka through this history, our app must respond by updating di shown content accordingly.
```mermaid
sequenceDiagram
participant User
participant Browser
participant App
participant Template
User->>Browser: Clicks "Login" link
Browser->>App: onclick event triggered
App->>App: preventDefault() & navigate('/dashboard')
App->>Browser: history.pushState('/dashboard')
Browser->>Browser: URL updates to /dashboard
App->>App: updateRoute() called
App->>Template: Find & clone dashboard template
Template->>App: Return cloned content
App->>Browser: Replace app content with template
Browser->>User: Display dashboard screen
Note over User,Template: User click browser back button
User->>Browser: Clicks back button
Browser->>Browser: History moves back to /login
Browser->>App: popstate event fired
App->>App: updateRoute() called automatically
App->>Template: Find & clone login template
Template->>App: Return cloned content
App->>Browser: Replace app content with template
Browser->>User: Display login screen
```
**Key interaction points:**
- **User actions** trigger navigation through clicks or browser buttons
- **App intercept** link clicks to stop page reload
- **History API** manage URL changes plus browser history stack
- **Templates** provide content structure for each screen
- **Event listeners** make sure app respond to all navigation types
Using `history.pushState` dey create new entries for browser navigation history. You fit check am by holding *back button* for your browser, e suppose show like dis:
![Screenshot of navigation history](../../../../translated_images/history.7fdabbafa521e064.pcm.png)
If you dey click back button small times, you go see say current URL dey change and history dey updated, but di same template still dey show.
Na because di app no sabi say we need call `updateRoute()` anytime history change. If you check di [`history.pushState` docs](https://developer.mozilla.org/docs/Web/API/History/pushState), you go see say if state change - meaning we don move to different URL - di [`popstate`](https://developer.mozilla.org/docs/Web/API/Window/popstate_event) event go trigger. We go use am fix dat wahala.
### Task
To make sure di shown template dey update anytime browser history change, we go add new function wey go call `updateRoute()`. We go put am for bottom of our `app.js` file:
```js
window.onpopstate = () => updateRoute();
updateRoute();
```
**Understand dis history integration:**
- **Listen** for `popstate` events wey dey happen if users navigate with browser buttons
- **Use** arrow function for short and clean event handler code
- **Call** `updateRoute()` automatically anytime history state change
- **Init** app by calling `updateRoute()` when page load first time
- **Ensure** say correct template go show no matter how user navigate
> 💡 **Pro Tip**: We use [arrow function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Functions/Arrow_functions) here to write our `popstate` event handler nicely, but regular function dey work the same.
Na refresher video about arrow functions:
[![Arrow Functions](https://img.youtube.com/vi/OP6eEbOj2sc/0.jpg)](https://youtube.com/watch?v=OP6eEbOj2sc "Arrow Functions")
> 🎥 Click di image above to watch video about arrow functions.
Now try use back and forward buttons for your browser, check say di route wey display don update well dis time.
### ⚡ **Wetyn You Fit Do Inside Next 5 Minutes**
- [ ] Test your banking app navigation using browser back/forward buttons
- [ ] Try type different URLs manually for address bar to test routing
- [ ] Open browser DevTools and check how templates dey clone inside DOM
- [ ] Try add console.log statements to follow routing flow
### 🎯 **Wetyn You Fit Achieve This Hour**
- [ ] Complete post-lesson quiz and sabi SPA architecture concepts
- [ ] Add CSS style to make your banking app templates look professional
- [ ] Implement 404 error page challenge with correct error handling
- [ ] Create credits page challenge with extra routing functionality
- [ ] Add loading states and transitions between template switches
### 📅 **Your Week-Long SPA Development Journey**
- [ ] Complete full banking app with forms, data management, and persistence
- [ ] Add advanced routing features like route parameters and nested routes
- [ ] Implement navigation guards and authentication-based routing
- [ ] Create reusable template components and component library
- [ ] Add animations and transitions for smoother user experience
- [ ] Deploy your SPA to hosting platform and configure routing well
### 🌟 **Your Month-Long Frontend Architecture Mastery**
- [ ] Build complex SPAs using modern frameworks like React, Vue, or Angular
- [ ] Learn advanced state management patterns and libraries
- [ ] Master build tools and development workflows for SPA development
- [ ] Implement Progressive Web App features and offline functionality
- [ ] Study performance optimization techniques for large SPAs
- [ ] Contribute to open source SPA projects and share your knowledge
## 🎯 Your Single-Page Application Mastery Timeline
```mermaid
timeline
title SPA Development & Modern Web Architecture Learning Progression
section Foundation (20 minutes)
Template Systems: HTML template elements
: DOM manipulation
: Content cloning
: Dynamic rendering
section Routing Basics (30 minutes)
Client-side Navigation: URL management
: History API
: Route mapping
: Event handling
section User Experience (40 minutes)
Navigation Polish: Browser integration
: Back button support
: Error handling
: Smooth transitions
section Architecture Patterns (50 minutes)
Professional SPAs: Component systems
: State management
: Performance optimization
: Error boundaries
section Advanced Techniques (1 week)
Framework Integration: React Router
: Vue Router
: Angular Router
: State libraries
section Production Skills (1 month)
Enterprise Development: Build systems
: Testing strategies
: Deployment pipelines
: Performance monitoring
```
### 🛠️ Your SPA Development Toolkit Summary
After you finish dis lesson, you don master:
- **Template Architecture**: Reusable HTML components with dynamic content rendering
- **Client-side Routing**: URL control and navigation without page reload
- **Browser Integration**: Use History API and back/forward button support
- **Event-driven Systems**: Navigation handling and user interaction management
- **DOM Manipulation**: Cloning templates, content switching, and element control
- **Error Handling**: Graceful fallback for wrong routes and missing content
- **Performance Patterns**: Efficient content loading and rendering methods
**Real-World Applications**: Your SPA skills fit directly go:
- **Modern Web Apps**: React, Vue, Angular, and other framework building
- **Progressive Web Apps**: Offline-capable apps with app-like experience
- **Enterprise Dashboards**: Business apps with multiple views
- **E-commerce Platforms**: Product catalog, shopping, checkout flows
- **Content Management**: Dynamic content creating and editing
- **Mobile Development**: Hybrid apps using web technologies
**Professional Skills Gained**: Now you sabi:
- **Architect** single-page applications wit proper separation of concerns
- **Implement** client-side routing systems wey fit scale wit application complexity
- **Debug** complex navigation flows usin browser developer tools
- **Optimize** application performance through efficient template management
- **Design** user experiences wey dey feel native and responsive
**Frontend Development Concepts Mastered**:
- **Component Architecture**: Reusable UI patterns and template systems
- **State Synchronization**: URL state management and browser history
- **Event-driven Programming**: User interaction handling and navigation
- **Performance Optimization**: Efficient DOM manipulation and content loading
- **User Experience Design**: Smooth transitions and intuitive navigation
**Next Level**: You don ready to explore modern frontend frameworks, advanced state management, or build complex enterprise applications!
🌟 **Achievement Unlocked**: You don build professional single-page application foundation wit modern web architecture patterns!
---
## GitHub Copilot Agent Challenge 🚀
Use the Agent mode to complete di following challenge:
**Description:** Enhance di banking app by implementing error handling and a 404 page template for invalid routes, improve di user experience wen dem dey navigate to pages wey no dey.
**Prompt:** Create new HTML template wit id "not-found" wey go show user-friendly 404 error page with styling. Then modify di JavaScript routing logic to show dis template wen users dey go invalid URLs, and add "Go Home" button wey go take dem back to di login page.
Learn more about [agent mode](https://code.visualstudio.com/blogs/2025/02/24/introducing-copilot-agent-mode) here.
## 🚀 Challenge
Add new template and route for third page wey go show di credits for dis app.
**Challenge goals:**
- **Create** new HTML template wit correct content structure
- **Add** di new route to your routes configuration object
- **Include** navigation links go and come from di credits page
- **Test** say all navigation dey work correct wit browser history
## Post-Lecture Quiz
[Post-lecture quiz](https://ff-quizzes.netlify.app/web/quiz/42)
## Review & Self Study
Routing na one of di wahala parts for web development, especially as web dey move from page refresh behaviors to Single Page Application page refreshes. Read small about [how di Azure Static Web App service](https://docs.microsoft.com/azure/static-web-apps/routes/?WT.mc_id=academic-77807-sagibbon) dey handle routing. You fit explain why some of di decisions wey dem talk for dat document dey necessary?
**Additional learning resources:**
- **Explore** how popular frameworks like React Router and Vue Router dey implement client-side routing
- **Research** di differences between hash-based routing and history API routing
- **Learn** about server-side rendering (SSR) and how e dey affect routing strategies
- **Investigate** how Progressive Web Apps (PWAs) dey handle routing and navigation
## Assignment
[Improve the routing](assignment.md)
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document dem don translate am wit AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator). Even though we dey try make e correct, abeg sabi say automated translation fit get some mistake or no too correct. The original document for im own language na di correct source wey you for trust. If na serious mata, abeg use professional human translation. We no go responsible if anybody misunderstand or use dis translation anyhow.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,60 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "df0dcecddcd28ea8cbf6ede0ad57d673",
"translation_date": "2026-01-08T17:09:20+00:00",
"source_file": "7-bank-project/1-template-route/assignment.md",
"language_code": "pcm"
}
-->
# Improve the Routing
## Instructions
Now wey you don build a basic routing system, na time to make am beta wit professional features wey go improve user experience and give better developer tools. Real-world applications need more than just template switching dem need dynamic page titles, lifecycle hooks, and extensible architectures.
For this assignment, you go extend your routing implementation wit two important features wey common for production web applications. These improvements go make your banking app dey feel more polished and give foundation for future functionality.
The routes declaration get only the template ID wey you go use currently. But when you dey display new page, sometimes you go need more small. Make we improve our routing implementation wit two additional features:
### Feature 1: Dynamic Page Titles
**Objective:** Give titles to each template and update the window title wit this new title when the template change.
**Why this matters:**
- **Improves** user experience by showing descriptive browser tab titles
- **Enhances** accessibility for screen readers and assistive technologies
- **Provides** better bookmarking and browser history context
- **Follows** professional web development best practices
**Implementation approach:**
- **Extend** the routes object to include title information for each route
- **Modify** the `updateRoute()` function to update `document.title` dynamically
- **Test** say titles dey change correct when you dey navigate between screens
### Feature 2: Route Lifecycle Hooks
**Objective:** Add option to run some code after the template don change. We want make e print `'Dashboard is shown'` for developer console anytime the dashboard page show.
**Why this matters:**
- **Enables** custom logic execution when specific routes load
- **Provides** hooks for analytics, logging, or initialization code
- **Creates** foundation for more complex route behaviors
- **Demonstrates** the observer pattern for web development
**Implementation approach:**
- **Add** optional callback function property to route configurations
- **Execute** the callback function (if e dey present) after template rendering don finish
- **Ensure** the feature dey work for any route wey get defined callback
- **Test** say the console message dey appear when you dey visit the dashboard
## Rubric
| Criteria | Exemplary | Adequate | Needs Improvement |
| -------- | ---------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- |
| | The two features don implement and dey work. Title and code addition sef dey work for new route wey dem add inside `routes` declaration. | The two features dey work, but the behavior hardcoded and e no dey configurable via the `routes` declaration. Adding third route wit title and code addition no dey work or e dey work partly. | One of the features dey miss or e no dey work properly. |
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis dokument don translate wit AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator). Even tho we try make am correct, abeg sabi say automated translation fit get mistake or no too clear. The original dokument wey dey inside im own language na di correct source. For important information, e better make person wey sabi translate am well do am. We no go responsible for any wrong understanding or wahala wey fit happen because of this translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,965 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "7cbdbd132d39a2bb493e85bc2a9387cc",
"translation_date": "2026-01-08T16:18:35+00:00",
"source_file": "7-bank-project/2-forms/README.md",
"language_code": "pcm"
}
-->
# Build a Banking App Part 2: Build a Login and Registration Form
```mermaid
journey
title Your Form Development Journey
section HTML Foundation
Understand form elements: 3: Student
Learn input types: 4: Student
Master accessibility: 4: Student
section JavaScript Integration
Handle form submission: 4: Student
Implement AJAX communication: 5: Student
Process server responses: 5: Student
section Validation Systems
Create multi-layer validation: 5: Student
Enhance user experience: 5: Student
Ensure data integrity: 5: Student
```
## Pre-Lecture Quiz
[Pre-lecture quiz](https://ff-quizzes.netlify.app/web/quiz/43)
You don ever fill form for internet before and e no gree accept your email format? Or you don lose all di information wen you click submit? We all don face dis kain wahala before.
Forms na bridge wey dey connect your users and your app functionality. Like how air traffic controllers take guide plane well so dem fit land safe, better-designed forms dey give clear feedback and e dey stop costly mistakes. Bad forms fit make users waka commot quick quick like how communication fail for busy airport.
For dis lesson, we go turn your static banking app to interactive application. You go learn how to build forms wey go check user input well, dey talk with servers, and give better feedback. Think am like building control interface weh go allow users guide your app features.
By di end, you go get complete login and registration system wey get validation wey dey guide users make dem succeed no be make dem frustrated.
```mermaid
mindmap
root((Form Development))
HTML Foundation
Semantic Elements
Input Types
Accessibility
Label Association
User Experience
Validation Feedback
Error Prevention
Loading States
Success Messaging
JavaScript Integration
Event Handling
AJAX Communication
Data Processing
Error Management
Validation Layers
HTML5 Validation
Client-side Logic
Server-side Security
Progressive Enhancement
Modern Patterns
Fetch API
Async/Await
Form Data API
Promise Handling
```
## Prerequisites
Before we start to build forms, make sure sey everything set well. Dis lesson na continuation from di last one, so if you jump pass, you fit wan go back make sure di basics dey work well first.
### Required Setup
| Component | Status | Description |
|-----------|--------|-------------|
| [HTML Templates](../1-template-route/README.md) | ✅ Required | Your basic banking app structure |
| [Node.js](https://nodejs.org) | ✅ Required | JavaScript runtime for the server |
| [Bank API Server](../api/README.md) | ✅ Required | Backend service for data storage |
> 💡 **Development Tip**: You go dey run two different servers at the same time one for your frontend banking app and anoda for backend API. Dis setup mirror how real-life development dey work where frontend and backend services dey independent.
### Server Configuration
**Your development environment go get:**
- **Frontend server**: Na im dey serve your banking app (usually port `3000`)
- **Backend API server**: Na im dey handle data storage and retrieval (port `5000`)
- **Both servers** fit run together without wahala
**To test your API connection:**
```bash
curl http://localhost:5000/api
# Wetin we expect make e respond: "Bank API v1.0.0"
```
**If you see di API version response, you ready to continue!**
---
## Understanding HTML Forms and Controls
HTML forms na how users dey talk to your web application. Think am like telegraph system weh connect far places for 19th century na communication protocol between user wahala and application response. When dem design am well, dem go catch errors, guide how user suppose enter data, and give better suggestions.
Today forms don better pass simple text inputs. HTML5 bring special input types wey dey handle email validation, number format, and date selection automatically. These improvements dey help both accessibility and mobile users.
### Essential Form Elements
**Building blocks every form need:**
```html
<!-- Basic form structure -->
<form id="userForm" method="POST">
<label for="username">Username</label>
<input id="username" name="username" type="text" required>
<button type="submit">Submit</button>
</form>
```
**Wetin dis code dey do:**
- **Creates** form container with unique id
- **Specifies** di HTTP method wey them go use submit data
- **Link** labels with inputs make e dey accessible
- **Get** submit button wey go process di form
### Modern Input Types and Attributes
| Input Type | Purpose | Example Usage |
|------------|---------|---------------|
| `text` | Normal text input | `<input type="text" name="username">` |
| `email` | Email validation | `<input type="email" name="email">` |
| `password` | Hidden text entry | `<input type="password" name="password">` |
| `number` | Number input | `<input type="number" name="balance" min="0">` |
| `tel` | Phone number | `<input type="tel" name="phone">` |
> 💡 **Modern HTML5 Advantage**: Using special input types mean automatic validation, correct mobile keyboards, and better accessibility support without extra JavaScript!
### Button Types and Behavior
```html
<!-- Different button behaviors -->
<button type="submit">Save Data</button> <!-- Submits the form -->
<button type="reset">Clear Form</button> <!-- Resets all fields -->
<button type="button">Custom Action</button> <!-- No default behavior -->
```
**Dis na wetin each button type dey do:**
- **Submit buttons**: Dey trigger form submission and send data go specified endpoint
- **Reset buttons**: Dey bring back all form fields to how dem start
- **Normal buttons**: No get default behaviour, need your own JavaScript to work
> ⚠️ **Important Note**: The `<input>` element na self-closing. You no need to close am like `<input />`. Best practice now na to write just `<input>` without slash.
### Building Your Login Form
Make we create practical login form wey show modern HTML form way of doing things. We go start with basic structure then add accessibility and validation slowly.
```html
<template id="login">
<h1>Bank App</h1>
<section>
<h2>Login</h2>
<form id="loginForm" novalidate>
<div class="form-group">
<label for="username">Username</label>
<input id="username" name="user" type="text" required
autocomplete="username" placeholder="Enter your username">
</div>
<button type="submit">Login</button>
</form>
</section>
</template>
```
**Breakdown of wetin dey happen here:**
- **Organizes** form using semantic HTML5 elements
- **Group** related parts inside `div` with good class names
- **Link** labels with inputs using `for` and `id`
- **Include** modern attributes like `autocomplete` and `placeholder` for better user experience
- **Add** `novalidate` so JavaScript fit handle validation, no be browser default
### The Power of Proper Labels
**Why labels dey important for modern web development:**
```mermaid
graph TD
A[Label Element] --> B[Screen Reader Support]
A --> C[Click Target Expansion]
A --> D[Form Validation]
A --> E[SEO Benefits]
B --> F[Accessible to all users]
C --> G[Betta mobile experience]
D --> H[Clear error messaging]
E --> I[Betta search ranking]
```
**Wetin good labels dey do:**
- **Allow** screen readers to announce form fields well well
- **Expand** clickable area (click label, input go get focus)
- **Make** mobile use easier with bigger touch targets
- **Support** form validation with better error messages
- **Improve** SEO cos e give semantic meaning to form
> 🎯 **Accessibility Goal**: Every form input suppose get label wey match am. This small thing go make your forms usable by everybody, including those wey get disabilities, and e go make experience better for all users.
### Creating the Registration Form
Registration form need plenty detail to make full user account. Make we build am with modern HTML5 features plus better accessibility.
```html
<hr/>
<h2>Register</h2>
<form id="registerForm" novalidate>
<div class="form-group">
<label for="user">Username</label>
<input id="user" name="user" type="text" required
autocomplete="username" placeholder="Choose a username">
</div>
<div class="form-group">
<label for="currency">Currency</label>
<input id="currency" name="currency" type="text" value="$"
required maxlength="3" placeholder="USD, EUR, etc.">
</div>
<div class="form-group">
<label for="description">Account Description</label>
<input id="description" name="description" type="text"
maxlength="100" placeholder="Personal savings, checking, etc.">
</div>
<div class="form-group">
<label for="balance">Starting Balance</label>
<input id="balance" name="balance" type="number" value="0"
min="0" step="0.01" placeholder="0.00">
</div>
<button type="submit">Create Account</button>
</form>
```
**For di form above, we don:**
- **Organize** every field inside container divs for better styling and layout
- **Add** proper `autocomplete` attributes for browser autofill
- **Put** good placeholder text to help user input
- **Set** sensible defaults with `value` attribute
- **Use** validation attributes like `required`, `maxlength`, and `min`
- **Use** `type="number"` for balance field with decimal support
### Exploring Input Types and Behavior
**Modern input types get better features:**
| Feature | Benefit | Example |
|---------|---------|----------|
| `type="number"` | Numeric keypad for mobile | Easier to enter balance |
| `step="0.01"` | Control decimal precision | Allow cents for money |
| `autocomplete` | Browser autofill | Faster to fill form |
| `placeholder` | Context hints | Help user know what to enter |
> 🎯 **Accessibility Challenge**: Try to move around form using only your keyboard! Use `Tab` to waka between fields, `Space` to check box, and `Enter` to submit. Dis experience go help you understand how screen reader users take use forms.
### 🔄 **Pedagogical Check-in**
**Form Foundation Understanding**: Before you start JavaScript, make sure you sabi:
- ✅ How semantic HTML dey create accessible form structure
- ✅ Why input types dey important for mobile keyboards and validation
- ✅ Relationship between labels and form controls
- ✅ How form attributes dey affect browser default behaviour
**Quick Self-Test**: Wetin happen if you submit form without JavaScript?
*Answer: Browser go do default submission, normally e go redirect to action URL*
**HTML5 Form Benefits**: Modern forms get:
- **Built-in Validation**: Automatic email and number format checking
- **Mobile Optimization**: Proper keyboards for input types
- **Accessibility**: Screen reader support and keyboard navigation
- **Progressive Enhancement**: E go still work even if JavaScript no dey
## Understanding Form Submission Methods
When person fill your form and click submit, that data must go somewhere normally server weh fit save am. Several ways dey do dis, and to sabi which one to use go help you avoid problem later.
Make we look wetin really happen when person click submit button.
### Default Form Behavior
First, make we see wetin happen with normal form submission:
**Test your forms:**
1. Click the *Register* button for your form
2. Look di address bar your browser
3. See how di page fresh and data enter for URL
![Screenshot of the browser's URL change after clicking the Register button](../../../../translated_images/click-register.e89a30bf0d4bc9ca.pcm.png)
### HTTP Methods Comparison
```mermaid
graph TD
A[Form Submission] --> B{HTTP Method}
B -->|GET| C[Data for URL]
B -->|POST| D[Data for Request Body]
C --> E[You fit see am for address bar]
C --> F[Data size no too big]
C --> G[You fit bookmark am]
D --> H[Hidden commot for URL]
D --> I[Data capacity big]
D --> J[More secure]
```
**Understand di difference:**
| Method | Use Case | Data Location | Security Level | Size Limit |
|--------|----------|---------------|----------------|-------------|
| `GET` | Search and filters | URL parameters | Low (everybody fit see) | ~2000 characters |
| `POST` | User accounts, sensitive info | Request body | Higher (hidden) | No real limit |
**Summary of difference:**
- **GET**: Data dey go URL as query parameters (good for search)
- **POST**: Data dey inside request body (better for sensitive info)
- **GET problems**: Small size limit, data dey show, dey save in browser history
- **POST pros**: Fit large data, private, fit upload files
> 💡 **Best Practice**: Use `GET` for search and filters (data retrieval), use `POST` for user registration, login, and data creation.
### Configuring Form Submission
Make we setup your registration form so e fit talk well with backend API using POST method:
```html
<form id="registerForm" action="//localhost:5000/api/accounts"
method="POST" novalidate>
```
**Dis configuration go do:**
- **Send** form data go your API endpoint
- **Use** POST method for secure data send
- **Add** `novalidate` so JavaScript go handle validation
### Testing Form Submission
**Do dis for test your form:**
1. **Fill** registration form with your info
2. **Click** "Create Account" button
3. **Look** server response for your browser
![A browser window at the address localhost:5000/api/accounts, showing a JSON string with user data](../../../../translated_images/form-post.61de4ca1b964d91a.pcm.png)
**Wetin you suppose see:**
- **Browser go redirect** go API endpoint URL
- **JSON response** wey get your new account data
- **Server confirmation** sey account create finish well
> 🧪 **Try am:** Register again with same username. Which response you go get? This to help you understand how server dey handle duplicate data and error cases.
### Understanding JSON Responses
**When server process your form well:**
```json
{
"user": "john_doe",
"currency": "$",
"description": "Personal savings",
"balance": 100,
"id": "unique_account_id"
}
```
**Dis response confirm:**
- **Create** new account with your data
- **Assign** unique ID for future use
- **Return** all account info make you check
- **Show** sey e don save inside database
## Modern Form Handling with JavaScript
Old style form submissions dey make page reload full time, like old space missions wey need reset to change course. E dey disturb user experience and e dey cause app lose context.
JavaScript form handling be like modern spacecraft control wey dey adjust course continuously e no dey lose navigation. We fit stop form submission, give feedback quick, handle errors better, and update interface base on server responses while user still dey inside app.
### Why Avoid Page Reloads?
```mermaid
sequenceDiagram
participant User
participant SPA
participant Server
User->>SPA: Send form
SPA->>Server: AJAX request
Server-->>SPA: JSON response
SPA->>User: Change interface
Note over User,SPA: No reload page!
```
**Benefits of JavaScript form handling:**
- **Keep** app state and user context
- **Give** quick feedback and show loading signs
- **Fit** handle errors dynamically and do validation
- **Make** smooth, app-like user experience
- **Allow** conditional logic base on server response
### Transitioning from Traditional to Modern Forms
**Problems with traditional way:**
- **Redirect** users away from your app
- **Lose** current app state and context
- **Need** full page reload for simple things
- **Gat limited control over user feedback**
**Good things about modern JavaScript way:**
- **Users stay** inside app
- **Keep** all app state and data
- **Allow** real-time validation and feedback
- **Support** progressive enhancement and accessibility
### Implementing JavaScript Form Handling
Make we replace traditional form submission with modern JavaScript event handling:
```html
<!-- Remove the action attribute and add event handling -->
<form id="registerForm" method="POST" novalidate>
```
**Add registration logic for your `app.js` file:**
```javascript
// Modern event-driven form handling
function register() {
const registerForm = document.getElementById('registerForm');
const formData = new FormData(registerForm);
const data = Object.fromEntries(formData);
const jsonData = JSON.stringify(data);
console.log('Form data prepared:', data);
}
// Attach event listener wen di page load
document.addEventListener('DOMContentLoaded', () => {
const registerForm = document.getElementById('registerForm');
registerForm.addEventListener('submit', (event) => {
event.preventDefault(); // Prevent default form submission
register();
});
});
```
**Breakdown of wetin dey happen here:**
- **Stop** default form submission with `event.preventDefault()`
- **Get** di form element using modern DOM selection
- **Get** form data with powerful `FormData` API
- **Convert** FormData to plain JavaScript object with `Object.fromEntries()`
- **Serialize** data to JSON for sending server
- **Log** processed data for debugging and check
### Understanding the FormData API
**FormData API na strong tool for form handling:**
```javascript
// Example of wetin FormData dey capture
const formData = new FormData(registerForm);
// FormData dey capture automatically:
// {
// "user": "john_doe",
// "currency": "$",
// "description": "Personal account",
// "balance": "100"
// }
```
**FormData API benefits dem:**
- **Complete collection**: E dey capture all form elements like text, files, and complex inputs
- **Type sabi**: E dey handle different input types automatically without you write custom code
- **Quick work**: E no need make you collect fields manully, na one API call e dey use
- **Flexible**: E go still work as form structure dey change
### How to Build Server Communication Function
Now make we build strong function wey go talk to your API server using modern JavaScript style:
```javascript
async function createAccount(account) {
try {
const response = await fetch('//localhost:5000/api/accounts', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
},
body: account
});
// Make sure say di response na success
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
return await response.json();
} catch (error) {
console.error('Account creation failed:', error);
return { error: error.message || 'Network error occurred' };
}
}
```
**How asynchronous JavaScript work:**
```mermaid
sequenceDiagram
participant JS as JavaScript
participant Fetch as Fetch API
participant Server as Backend Server
JS->>Fetch: fetch() request
Fetch->>Server: HTTP POST
Server-->>Fetch: JSON response
Fetch-->>JS: await response
JS->>JS: Process data
```
**Wetin dis modern implementation dey do:**
- **E dey use** `async/await` for code wey easy to read dey do async
- **E get** proper error handling wit try/catch blocks
- **E dey check** response status before e process data
- **E set** correct headers for JSON communication
- **E dey give** better error messages for debugging
- **E dey return** consistent data structure for success and error
### Power of Modern Fetch API
**Fetch API better pass old methods:**
| Feature | Benefit | Implementation |
|---------|---------|----------------|
| Promise-based | Clean async code | `await fetch()` |
| Request customization | Full HTTP control | Headers, methods, body |
| Response handling | Flexible data parsing | `.json()`, `.text()`, `.blob()` |
| Error handling | Comprehensive error catching | Try/catch blocks |
> 🎥 **Learn More**: [Async/Await Tutorial](https://youtube.com/watch?v=YwmlRkrxvkk) - Understand how asynchronous JavaScript patterns dey work for modern web development.
**Important things for server communication:**
- **Async functions** fit pause to wait for server response
- **Await keyword** make asynchronous code read like normal synchronous code
- **Fetch API** na modern, promise-based HTTP requests
- **Error handling** ensure app no go crash and dey react well to network wahala
### Complete Registration Function
Make we put everything together wit complete, production-ready registration function:
```javascript
async function register() {
const registerForm = document.getElementById('registerForm');
const submitButton = registerForm.querySelector('button[type="submit"]');
try {
// Show di loading state
submitButton.disabled = true;
submitButton.textContent = 'Creating Account...';
// Process di form data
const formData = new FormData(registerForm);
const jsonData = JSON.stringify(Object.fromEntries(formData));
// Send am go server
const result = await createAccount(jsonData);
if (result.error) {
console.error('Registration failed:', result.error);
alert(`Registration failed: ${result.error}`);
return;
}
console.log('Account created successfully!', result);
alert(`Welcome, ${result.user}! Your account has been created.`);
// Reset di form after e don register well
registerForm.reset();
} catch (error) {
console.error('Unexpected error:', error);
alert('An unexpected error occurred. Please try again.');
} finally {
// Make button state normal again
submitButton.disabled = false;
submitButton.textContent = 'Create Account';
}
}
```
**Dis improved implementation get:**
- **E dey show** visual feedback when form dey submit
- **E dey disable** submit button make person no submit multiply times
- **E dey handle** both expected and unexpected error well
- **E dey show** user-friendly success and error messages
- **E dey reset** form after registration wey succeeed
- **E dey restore** UI status no matter result
### Test Your Implementation
**Open your browser dev tools make you test registration:**
1. **Open** browser console (F12 → Console tab)
2. **Fill** the registration form
3. **Click** "Create Account"
4. **Watch** console messages and user feedback
![Screenshot showing log message in the browser console](../../../../translated_images/browser-console.efaf0b51aaaf6778.pcm.png)
**Wetin you go see:**
- **Loading state** show for submit button
- **Console logs** show detailed information about wetin dey happen
- **Success message** show wen account create finish well
- **Form reset** automatically after submission
> 🔒 **Security Reminder**: Right now, data dey waka through HTTP, e no secure for production. For real apps, always use HTTPS make data safe. Learn more about [HTTPS security](https://en.wikipedia.org/wiki/HTTPS) and why e important to protect user data.
### 🔄 **Pedagogical Check-in**
**Modern JavaScript Integration**: Confirm say you sabi async form handling:
- ✅ How `event.preventDefault()` take change default form behaviour?
- ✅ Why FormData API dey more efficient than manual field collection?
- ✅ How async/await patterns improve code readability?
- ✅ Wetin error handling role be for user experience?
**System Architecture**: Your form handling dey show:
- **Event-Driven Programming**: Forms dey react to user actions without page reload
- **Asynchronous Communication**: Server request no go block UI
- **Error Handling**: App go still dey work when network request fail
- **State Management**: UI dey update based on server response correctly
- **Progressive Enhancement**: Basic feature work, JavaScript na im dey add better things
**Professional Patterns**: You don implement:
- **Single Responsibility**: Functions get clear and focused job
- **Error Boundaries**: Try/catch blocks stop app crash
- **User Feedback**: Loading states and success/error messages
- **Data Transformation**: FormData to JSON for server talk
## Complete Form Validation
Validating form dey save people from stress of finding error after dem submit. Like how International Space Station get many safety systems, good validation get layers of checks.
Best way na combine browser level validation for quick feedback, JavaScript validation for better user experience, and server validation to secure data. This approach dey protect both user happiness and system safety.
### Understanding Validation Layers
```mermaid
graph TD
A[User Input] --> B[HTML5 Validation]
B --> C[Custom JavaScript Validation]
C --> D[Client-Side Complete]
D --> E[Server-Side Validation]
E --> F[Data Storage]
B -->|Invalid| G[Browser Error Message]
C -->|Invalid| H[Custom Error Display]
E -->|Invalid| I[Server Error Response]
```
**Multiple layers validation strategy:**
- **HTML5 validation**: Browser checks immediately
- **JavaScript validation**: Custom logic and better user experience
- **Server validation**: Final security and data accuracy check
- **Progressive enhancement**: E still work even if JavaScript turn off
### HTML5 Validation Attributes
**Modern validation tools for your use:**
| Attribute | Purpose | Example Usage | Browser Behavior |
|-----------|---------|---------------|------------------|
| `required` | Fields wey you must fill | `<input required>` | No allow empty submission |
| `minlength`/`maxlength` | Text length limits | `<input maxlength="20">` | Restrict characters number |
| `min`/`max` | Number range | `<input min="0" max="1000">` | Check number inside limits |
| `pattern` | Custom regex rules | `<input pattern="[A-Za-z]+">` | Match specific format |
| `type` | Validate data type | `<input type="email">` | Ensure format correct |
### CSS Validation Styling
**Make visual feedback for validation state:**
```css
/* Valid input styling */
input:valid {
border-color: #28a745;
background-color: #f8fff9;
}
/* Invalid input styling */
input:invalid {
border-color: #dc3545;
background-color: #fff5f5;
}
/* Focus states for better accessibility */
input:focus:valid {
box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
}
input:focus:invalid {
box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}
```
**Wetin these visual signals dey do:**
- **Green borders**: Show validation pass, like green light for control room
- **Red borders**: Show validation errors wey need attention
- **Focus highlight**: Show where input active clearly
- **Consistent style**: Make interface pattern clear for users to sabi
> 💡 **Pro Tip**: Use `:valid` and `:invalid` CSS pseudo-classes to give instant visual feedback as people dey type, make interface responsive and helpful.
### Implement Complete Validation
Make we improve your registration form with strong validation wey go give better user experience and quality data:
```html
<form id="registerForm" method="POST" novalidate>
<div class="form-group">
<label for="user">Username <span class="required">*</span></label>
<input id="user" name="user" type="text" required
minlength="3" maxlength="20"
pattern="[a-zA-Z0-9_]+"
autocomplete="username"
title="Username must be 3-20 characters, letters, numbers, and underscores only">
<small class="form-text">Choose a unique username (3-20 characters)</small>
</div>
<div class="form-group">
<label for="currency">Currency <span class="required">*</span></label>
<input id="currency" name="currency" type="text" required
value="$" maxlength="3"
pattern="[A-Z$€£¥₹]+"
title="Enter a valid currency symbol or code">
<small class="form-text">Currency symbol (e.g., $, €, £)</small>
</div>
<div class="form-group">
<label for="description">Account Description</label>
<input id="description" name="description" type="text"
maxlength="100"
placeholder="Personal savings, checking, etc.">
<small class="form-text">Optional description (up to 100 characters)</small>
</div>
<div class="form-group">
<label for="balance">Starting Balance</label>
<input id="balance" name="balance" type="number"
value="0" min="0" step="0.01"
title="Enter a positive number for your starting balance">
<small class="form-text">Initial account balance (minimum $0.00)</small>
</div>
<button type="submit">Create Account</button>
</form>
```
**Understanding improved validation:**
- **Combine** required field marks with useful descriptions
- **Get** `pattern` attributes for format check
- **Add** `title` attributes for accessibility and tooltips
- **Put** helper text to guide user input
- **Use** semantic HTML structure for better accessibility
### Advanced Validation Rules
**What each validation rule do:**
| Field | Validation Rules | User Benefit |
|-------|------------------|--------------|
| Username | `required`, `minlength="3"`, `maxlength="20"`, `pattern="[a-zA-Z0-9_]+"` | Make sure id valid and unique |
| Currency | `required`, `maxlength="3"`, `pattern="[A-Z$€£¥₹]+"` | Accept common currency signs |
| Balance | `min="0"`, `step="0.01"`, `type="number"` | Stop negative balances |
| Description | `maxlength="100"` | Reasonable limit for text |
### Test Validation Behavior
**Try these validation cases:**
1. **Submit** form wit empty required fields
2. **Put** username wey too short (less than 3)
3. **Try** special characters for username
4. **Input** negative number for balance
![Screenshot showing the validation error when trying to submit the form](../../../../translated_images/validation-error.8bd23e98d416c22f.pcm.png)
**Wetin you go see:**
- **Browser show** native validation messages
- **Style go change** based on `:valid` and `:invalid`
- **Form no go submit** until all validation pass
- **Focus go move** to first invalid field automatically
### Client-Side vs Server-Side Validation
```mermaid
graph LR
A[Client-Side Validation] --> B[Quick Quick Feedback]
A --> C[Beta UX]
A --> D[Reduced Server Load]
E[Server-Side Validation] --> F[Security]
E --> G[Data Integrity]
E --> H[Business Rules]
A -.-> I[Bote Dem Dey Needed]
E -.-> I
```
**Why you need both validation levels:**
- **Client-side validation**: Quick feedback and better user experience
- **Server-side validation**: Secure and handle complex rules
- **Together**: Make app strong, user-friendly, and secure
- **Progressive enhancement**: E still work if JavaScript off
> 🛡️ **Security Reminder**: No trust client-side validation alone! Bad people fit bypass am, so always do server-side validation for safety and data integrity.
### ⚡ **Wetyn You Fit Do in Next 5 Minutes**
- [ ] Test your form with wrong data to see validation messages
- [ ] Try submit form with JavaScript off to see HTML5 validation
- [ ] Open browser DevTools check form data wey dey send to server
- [ ] Try different input types to see mobile keyboard change
### 🎯 **Wetyn You Fit Achieve This Hour**
- [ ] Finish post-lesson test and understand form handling concepts
- [ ] Implement full validation challenge with instant feedback
- [ ] Add CSS style to make professional looking forms
- [ ] Add error handling for duplicate usernames and server issues
- [ ] Add password confirmation with matching validation
### 📅 **Your Week-Long Form Mastery Journey**
- [ ] Build full banking app with advanced form features
- [ ] Add file upload support for profile pics or documents
- [ ] Create multi-step forms with progress and state control
- [ ] Build dynamic forms wey adjust based on user choice
- [ ] Add form autosave and recovery for better user experience
- [ ] Add advanced validation like email and phone formatting
### 🌟 **Your Month-Long Frontend Development Mastery**
- [ ] Build complex form apps wit conditional logic and workflow
- [ ] Learn form libraries and frameworks for faster development
- [ ] Master accessibility guidelines and inclusive design
- [ ] Implement i18n and localization for global forms
- [ ] Create reusable form component libraries and design systems
- [ ] Contribute to open source form projects and share best practice
## 🎯 Your Form Development Mastery Timeline
```mermaid
timeline
title Form Development & User Experience Learning Progression
section HTML Foundation (15 minutes)
Semantic Forms: Form elements
: Input types
: Labels and accessibility
: Progressive enhancement
section JavaScript Integration (25 minutes)
Event Handling: Form submission
: Data collection
: AJAX communication
: Async/await patterns
section Validation Systems (35 minutes)
Multi-layer Security: HTML5 validation
: Client-side logic
: Server-side verification
: Error handling
section User Experience (45 minutes)
Interface Polish: Loading states
: Success messaging
: Error recovery
: Accessibility features
section Advanced Patterns (1 week)
Professional Forms: Dynamic validation
: Multi-step workflows
: File uploads
: Real-time feedback
section Enterprise Skills (1 month)
Production Applications: Form libraries
: Testing strategies
: Performance optimization
: Security best practices
```
### 🛠️ Your Form Development Toolkit Summary
After dis lesson, you don master:
- **HTML5 Forms**: Good structure, input types, and accessibility
- **JavaScript Form Handling**: Events, data collection, AJAX communication
- **Validation Architecture**: Multi-layer checks for security and UX
- **Asynchronous Programming**: Modern fetch API and async/await
- **Error Management**: Complete error catching and user feedback
- **User Experience Design**: Loading, success messages, error recovery
- **Progressive Enhancement**: Forms work on all browsers and setups
**Real-World Applications**: Your form skill fit:
- **E-commerce Apps**: Checkout, signup, payment forms
- **Enterprise Software**: Data entry, reports, workflow apps
- **Content Management**: Publishing, user content, admin tools
- **Finance Apps**: Banking, investments, transactions
- **Healthcare**: Patient portals, scheduling, medical forms
- **Education**: Course sign-up, assessments, LMS
**Professional Skills You Get**:
- **Design** accessible forms for all users including disabled
- **Implement** secure validation to stop data corruption and attacks
- **Create** responsive UI wey give clear feedback and guide users
- **Debug** complex forms using browser dev tools and network checks
- **Optimize** form performance through data handling and validation
**Frontend Development Concepts You Master**:
- **Event-Driven Architecture**: User interaction and response
- **Asynchronous Programming**: Non-blocking server talk and error handle
- **Data Validation**: Client and server side security and integrity
- **User Experience Design**: Easy interfaces wey guide success
- **Accessibility Engineering**: Inclusive design for diverse needs
**Next Steps**: You ready to learn advanced form libraries, complex validation, or build enterprise data systems!
🌟 **Achievement Unlocked**: You don build complete form system with pro validation, error handling, and UX patterns!
---
---
## GitHub Copilot Agent Challenge 🚀
Use Agent mode to finish this challenge:
**Description:** Make the registration form better with full client-side validation and user feedback. Dis challenge go help you practice validation, error handling, and improve user experience with interactive feedback.
**Prompt:** Create a complete form validation system for the registration form wey get: 1) Real-time validation feedback for every field as di user dey type, 2) Custom validation messages wey dey show under every input field, 3) Password confirmation field wey dey check if dem match, 4) Visual indicators (like green checkmarks for valid fields and red warnings for invalid ones), 5) Submit button wey go only active when all validations don pass. Use HTML5 validation attributes, CSS to style the validation states, and JavaScript for the interactive behavior.
Learn more about [agent mode](https://code.visualstudio.com/blogs/2025/02/24/introducing-copilot-agent-mode) here.
## 🚀 Challenge
Show error message for the HTML if di user don already exist.
Here be example of how the final login page fit look after small styling:
![Screenshot of the login page after adding CSS styles](../../../../translated_images/result.96ef01f607bf856a.pcm.png)
## Post-Lecture Quiz
[Post-lecture quiz](https://ff-quizzes.netlify.app/web/quiz/44)
## Review & Self Study
Developers don become very creative for their form building, especially for validation strategies. Learn about different form flows by checking [CodePen](https://codepen.com); fit you find some interesting and inspiring forms?
## Assignment
[Style your bank app](assignment.md)
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document na wetin AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator) help translate. Even though we dey try make am correct, abeg sabi say automated translation fit get errors or no too correct sometimes. The original document for im own language na di correct one wey you suppose trust. For important information, make person wey sabi translation do am human way. We no go responsible if person misunderstand or misinterpret anything because of dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,166 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "efb01fcafd2ef40c593a6e662fc938a8",
"translation_date": "2026-01-08T16:34:34+00:00",
"source_file": "7-bank-project/2-forms/assignment.md",
"language_code": "pcm"
}
-->
# Style Your Bank App wit Modern CSS
## Project Overview
Change your functional banking application to one wey fine to look, professional web app using modern CSS techniques. You go create one system wey go make design dey solid, improve user experience plus still keep accessibility and responsive design principles.
Dis assignment dey make you use contemporary web design style, do consistent visual identity, and create interface wey users go find attractive and easy to waka.
## Instructions
### Step 1: Setup Your Stylesheet
**Create your CSS foundation:**
1. **Create** one new file wey go be `styles.css` for your project root
2. **Link** the stylesheet inside your `index.html` file:
```html
<link rel="stylesheet" href="styles.css">
```
3. **Start** with CSS reset and modern defaults:
```css
/* Modern CSS reset and base styles */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
line-height: 1.6;
color: #333;
}
```
### Step 2: Design System Requirements
**Put these important design elements:**
#### Color Palette
- **Primary color**: Choose one professional color for buttons and highlights
- **Secondary color**: Complementary color for accents and secondary actions
- **Neutral colors**: Grays for text, borders, and backgrounds
- **Success/Error colors**: Green for success states, red for errors
#### Typography
- **Heading hierarchy**: Clear difference between H1, H2, and H3 elements
- **Body text**: Font size wey you fit read well (minimum 16px) and correct line height
- **Form labels**: Clear, accessible text styling
#### Layout and Spacing
- **Consistent spacing**: Use one spacing scale (8px, 16px, 24px, 32px)
- **Grid system**: Organized layout for forms and content sections
- **Responsive design**: Mobile-first approach with breakpoints
### Step 3: Component Styling
**Style these particular components:**
#### Forms
- **Input fields**: Professional borders, focus states, and validation styling
- **Buttons**: Hover effects, disabled states, and loading indicators
- **Labels**: Clear positioning and required field indicators
- **Error messages**: Visible error styling and helpful messaging
#### Navigation
- **Header**: Clean, branded navigation area
- **Links**: Clear hover states and active indicators
- **Logo/Title**: Distinctive branding element
#### Content Areas
- **Sections**: Clear visual separation between different areas
- **Cards**: If you dey use card-based layouts, include shadows and borders
- **Backgrounds**: Correct use of white space and subtle backgrounds
### Step 4: Enhanced Features (Optional)
**Think about adding these advanced features:**
- **Dark mode**: Toggle between light and dark themes
- **Animations**: Subtle transitions and micro-interactions
- **Loading states**: Visual feedback during form submissions
- **Responsive images**: Optimized images for different screen sizes
## Design Inspiration
**Modern banking app characteristics:**
- **Clean, minimal design** wit plenty white space
- **Professional color schemes** (blues, greens, or sophisticated neutrals)
- **Clear visual hierarchy** wit prominent call-to-action buttons
- **Accessible contrast ratios** wey meet WCAG guidelines
- **Mobile-responsive layouts** wey work well on all devices
## Technical Requirements
### CSS Organization
```css
/* 1. CSS Custom Properties (Variables) */
:root {
--primary-color: #007bff;
--secondary-color: #6c757d;
/* Add more variables */
}
/* 2. Base Styles */
/* Reset, typography, general elements */
/* 3. Layout */
/* Grid, flexbox, positioning */
/* 4. Components */
/* Forms, buttons, cards */
/* 5. Utilities */
/* Helper classes, responsive utilities */
/* 6. Media Queries */
/* Responsive breakpoints */
```
### Accessibility Requirements
- **Color contrast**: Make sure say e get at least 4.5:1 ratio for normal text
- **Focus indicators**: Visible focus states for keyboard navigation
- **Form labels**: Properly linked with inputs
- **Responsive design**: Fit work for screens from 320px to 1920px wide
## Evaluation Rubric
| Criteria | Exemplary (A) | Proficient (B) | Developing (C) | Needs Improvement (F) |
|----------|---------------|----------------|----------------|----------------------|
| **Design System** | Implements comprehensive design system with consistent colors, typography, and spacing throughout | Uses consistent styling with clear design patterns and good visual hierarchy | Basic styling applied with some consistency issues or missing design elements | Minimal styling with inconsistent or conflicting design choices |
| **User Experience** | Creates intuitive, professional interface with excellent usability and visual appeal | Provides good user experience with clear navigation and readable content | Basic usability with some UX improvements needed | Poor usability, difficult to navigate or read |
| **Technical Implementation** | Uses modern CSS techniques, organized code structure, and follows best practices | Implements CSS effectively with good organization and appropriate techniques | CSS works correctly but may lack organization or modern approaches | Poor CSS implementation with technical issues or browser compatibility problems |
| **Responsive Design** | Fully responsive design that works beautifully across all device sizes | Good responsive behavior with minor issues on some screen sizes | Basic responsive implementation with some layout issues | Not responsive or significant problems on mobile devices |
| **Accessibility** | Meets WCAG guidelines with excellent keyboard navigation and screen reader support | Good accessibility practices with proper contrast and focus indicators | Basic accessibility considerations with some missing elements | Poor accessibility, difficult for users with disabilities |
## Submission Guidelines
**Put inside your submission:**
- **styles.css**: Your complete stylesheet
- **Updated HTML**: Any HTML changes wey you do
- **Screenshots**: Images wey dey show your design for desktop and mobile
- **README**: Brief description of your design choices and color palette
**Bonus points for:**
- **CSS custom properties** for mother way you fit maintain theming
- **Advanced CSS features** like Grid, Flexbox, or CSS animations
- **Performance considerations** like optimized CSS and small file size
- **Cross-browser testing** to make sure e fit work for different browsers
> 💡 **Pro Tip**: Start wit mobile design first, then improve for bigger screens. Dis mobile-first approach dey make sure your app work well for all devices and follow modern web development best practices.
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document na wetin AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator) translate. Even though we try make am correct, abeg sabi say automated translation fit get wahala or mistakes. The original document for im own language na the correct one wey you suppose trust. If na important info, better make human professional translate am. We no go take blame if person no understand well or if dem use am wrong.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,970 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "86ee5069f27ea3151389d8687c95fac9",
"translation_date": "2026-01-08T17:12:03+00:00",
"source_file": "7-bank-project/3-data/README.md",
"language_code": "pcm"
}
-->
# Build a Banking App Part 3: Methods of Fetching and Using Data
Think about di Enterprise computer for Star Trek - wen Captain Picard ask for ship status, di information show sharp sharp without di whole interface stop to rebuild by itself. Dat smooth flow of information na exactly wetin we dey build here wit dynamic data fetching.
Right now, your banking app dey like one printed newspaper - informative but e no dey change. We go turn am to something like NASA mission control, wey data go dey flow steady steady and dey update for real-time without interrupt di person wey dey use am.
You go sabi how to talk wit servers asynchronously, handle data wey go show at different times, and turn raw information to something wey get meaning for your users. Na di difference between demo and production-ready software dis be.
## ⚡ Wetin You Fit Do For Next 5 Minutes
**Quick Start Pathway for Busy Developers**
```mermaid
flowchart LR
A[⚡ 5 minutes] --> B[Set up API server]
B --> C[Test fetch with curl]
C --> D[Create login function]
D --> E[See data for action]
```
- **Minute 1-2**: Start your API server (`cd api && npm start`) and test di connection
- **Minute 3**: Create basic `getAccount()` function wit fetch
- **Minute 4**: Connect di login form wit `action="javascript:login()"`
- **Minute 5**: Test login and see account data show for di console
**Quick Test Commands**:
```bash
# Check say API dey run
curl http://localhost:5000/api
# Test to grab account data
curl http://localhost:5000/api/accounts/test
```
**Why Dis Matter**: For 5 minutes, you go see di magic of asynchronous data fetching wey power every modern web app. Na di foundation wey make apps feel responsive and alive.
## 🗺️ Your Learning Journey Through Data-Driven Web Applications
```mermaid
journey
title From Static Pages to Dynamic Applications
section Understanding the Evolution
Traditional page reloads: 3: You
Discover AJAX/SPA benefits: 5: You
Master Fetch API patterns: 7: You
section Building Authentication
Create login functions: 4: You
Handle async operations: 6: You
Manage user sessions: 8: You
section Dynamic UI Updates
Learn DOM manipulation: 5: You
Build transaction displays: 7: You
Create responsive dashboards: 9: You
section Professional Patterns
Template-based rendering: 6: You
Error handling strategies: 7: You
Performance optimization: 8: You
```
**Your Journey Destination**: By di end of dis lesson, you go understand how modern web apps dey fetch, process, and display data dynamically, creating di smooth user experiences wey we dey expect from pro applications.
## Pre-Lecture Quiz
[Pre-lecture quiz](https://ff-quizzes.netlify.app/web/quiz/45)
### Prerequisites
Before you jump enter data fetching, make sure say you get these components ready:
- **Previous Lesson**: Finish di [Login and Registration Form](../2-forms/README.md) - we go build on top dis
- **Local Server**: Install [Node.js](https://nodejs.org) and [run di server API](../api/README.md) to provide account data
- **API Connection**: Test your server connection wit dis command:
```bash
curl http://localhost:5000/api
# Wetin we expect for response: "Bank API v1.0.0"
```
Dis quick test dey make sure all components dey communicate well:
- Confirm say Node.js dey run correct for your system
- Show say your API server dey active and e dey respond
- Make sure say your app fit reach di server (like checking radio contact before mission)
## 🧠 Data Management Ecosystem Overview
```mermaid
mindmap
root((Data Management))
Authentication Flow
Login Process
Form Validation
Credential Verification
Session Management
User State
Global Account Object
Navigation Guards
Error Handling
API Communication
Fetch Patterns
GET Requests
POST Requests
Error Responses
Data Formats
JSON Processing
URL Encoding
Response Parsing
Dynamic UI Updates
DOM Manipulation
Safe Text Updates
Element Creation
Template Cloning
User Experience
Real-time Updates
Error Messages
Loading States
Security Considerations
XSS Prevention
textContent Usage
Input Sanitization
Safe HTML Creation
CORS Handling
Cross-Origin Requests
Header Configuration
Development Setup
```
**Core Principle**: Modern web apps na data control systems - dem dey coordinate between user interfaces, server APIs, and browser security settings to create smooth, responsive experiences.
---
## Understanding Data Fetching in Modern Web Apps
How web apps dey handle data don change wella for di past twenty years. Understanding dis change go help you appreciate why modern tools like AJAX and Fetch API powerful and why web developers no fit do without dem.
Make we look how traditional websites dey work compare to di dynamic, responsive apps wey we dey build nowadays.
### Traditional Multi-Page Applications (MPA)
For early days of web, every click be like changing TV channels - di screen go blank then slowly show di new content. Dat na how early web apps be, where every interaction mean say dem go rebuild di whole page from zero.
```mermaid
sequenceDiagram
participant User
participant Browser
participant Server
User->>Browser: Click link or submit form
Browser->>Server: Requests new HTML page
Note over Browser: Page turn blank
Server->>Browser: Returns complete HTML page
Browser->>User: Show new page (flash/reload)
```
![Update workflow in a multi-page application](../../../../translated_images/mpa.7f7375a1a2d4aa77.pcm.png)
**Wetin make dis approach be clunky:**
- Every click mean rebuild di whole page from scratch
- Users go dey interrupt for middle of thing because of those annoying page flashes
- Your internet go do overtime to download di same header and footer again and again
- Apps go feel like you dey click through filing cabinet no be real software
### Modern Single-Page Applications (SPA)
AJAX (Asynchronous JavaScript and XML) change dis matter completly. Like di modular design of International Space Station wey astronauts fit change parts without building am again, AJAX let us update special parts of webpage without reloading everything. Even though e get XML for di name, we mostly dey use JSON now, but di main idea na say update only wetin need to change.
```mermaid
sequenceDiagram
participant User
participant Browser
participant JavaScript
participant Server
User->>Browser: Dey interact wit page
Browser->>JavaScript: Dey trigger event handler
JavaScript->>Server: Dey fetch only needed data
Server->>JavaScript: Dey return JSON data
JavaScript->>Browser: Dey update specific page elements
Browser->>User: Dey show updated content (no reload)
```
![Update workflow in a single-page application](../../../../translated_images/spa.268ec73b41f992c2.pcm.png)
**Why SPAs feel better:**
- Only di parts wey change dey update (smart na so)
- No sudden interruption - users fit dey flow steady
- Less data dey move for network so loading fast
- Everything dey sharp and responsive, like apps for phone
### The Evolution to Modern Fetch API
Modern browsers get [`Fetch` API](https://developer.mozilla.org/docs/Web/API/Fetch_API) wey replace old [`XMLHttpRequest`](https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest/). Like di difference between telegraph and email, Fetch API use promise for clean asynchronous code and e sabi handle JSON naturally.
| Feature | XMLHttpRequest | Fetch API |
|---------|----------------|----------|
| **Syntax** | Complex callback-based | Clean promise-based |
| **JSON Handling** | Must parse manually | Get built-in `.json()` method |
| **Error Handling** | Limited info | Plenty error details |
| **Modern Support** | Old browsers | ES6+ promises and async/await |
> 💡 **Browser Compatibility**: Good news - Fetch API dey work for all modern browsers! If you want know specific versions, [caniuse.com](https://caniuse.com/fetch) get full compatibility story.
>
**Bottom line:**
- E work well for Chrome, Firefox, Safari, Edge (basically everywhere your users dey)
- Only Internet Explorer need special help (and honestly, time to drop IE)
- E prepare you for better async/await style wey we go use later
### Implementing User Login and Data Retrieval
Make we implement login system wey go transform your banking app from static display to functional app. Like the authentication dem dey use for secure military places, we go check user credentials then give access to their data.
We go build am step by step, starting wit basic authentication then add data-fetching ability.
#### Step 1: Create the Login Function Foundation
Open your `app.js` file and add new `login` function wey go handle user authentication:
```javascript
async function login() {
const loginForm = document.getElementById('loginForm');
const user = loginForm.user.value;
}
```
**Make we break am down:**
- Dat `async` keyword mean say JavaScript dey expect say dis function fit need wait
- We dey grab di form from di page (no wahala, just find by ID)
- Then we dey pull wetin user type as username
- One correct trick: you fit grab any form input by its `name` attribute - no need extra getElementById palava!
> 💡 **Form Access Pattern**: Every form control fit access by its name (wey dem set for HTML using `name` attribute) as property of form. E make code clean and easy to read.
#### Step 2: Create the Account Data Fetching Function
Next, create function to get account data from server. E go similar your registration function but e focus on data fetching:
```javascript
async function getAccount(user) {
try {
const response = await fetch('//localhost:5000/api/accounts/' + encodeURIComponent(user));
return await response.json();
} catch (error) {
return { error: error.message || 'Unknown error' };
}
}
```
**Wetin dis code dey do:**
- **Use** modern `fetch` API for async data request
- **Build** GET request URL with username parameter
- **Use** `encodeURIComponent()` to handle special characters safe for URLs
- **Convert** response to JSON for easy work
- **Catch** errors well by returning error object instead of crashing
> ⚠️ **Security Note**: `encodeURIComponent()` dey handle special characters for URLs. Like naval communication encoding, e make sure your message arrive safe, so characters like "#" or "&" no go spoil am.
>
**Why dis matter:**
- Stop special characters from breaking URLs
- Protect from URL manipulation attack
- Make sure server receive correct data
- Follow secure coding style
#### Understanding HTTP GET Requests
One thing wey fit surprise you: wen you use `fetch` without extra option, e dey create a [`GET`](https://developer.mozilla.org/docs/Web/HTTP/Methods/GET) request automatically. Dis fit di kind request wey we want - to ask server "hey, abeg show me this user's account data?"
Think of GET request like polite asker wey want borrow book from library - you dey request to see something wey dey there already. POST request (wey we use for registration) na like you dey submit new book to add for library.
| GET Request | POST Request |
|-------------|--------------|
| **Purpose** | Retrieve data wey exist | Send new data to server |
| **Parameters** | For URL path or query string | For request body |
| **Caching** | Fit cache by browsers | Normally no cache |
| **Security** | Visible for URL and logs | Hidden for request body |
```mermaid
sequenceDiagram
participant B as Browser
participant S as Server
Note over B,S: GET Request (Data Retrieval)
B->>S: GET /api/accounts/test
S-->>B: 200 OK + Account Data
Note over B,S: POST Request (Data Submission)
B->>S: POST /api/accounts + New Account Data
S-->>B: 201 Created + Confirmation
Note over B,S: Error Handling
B->>S: GET /api/accounts/nonexistent
S-->>B: 404 Not Found + Error Message
```
#### Step 3: Bringing It All Together
Now di satisfying part - make we connect your account fetching function to login process. Na here everything just work:
```javascript
async function login() {
const loginForm = document.getElementById('loginForm');
const user = loginForm.user.value;
const data = await getAccount(user);
if (data.error) {
return console.log('loginError', data.error);
}
account = data;
navigate('/dashboard');
}
```
Dis function get clear sequence:
- Extract username from form input
- Ask server for user account data
- Handle any error weh fit show
- Save account data and waka go dashboard if success
> 🎯 **Async/Await Pattern**: Since `getAccount` na async function, we use `await` to make code wait till server respond. E prevent code from running wit undefined data.
#### Step 4: Creating a Home for Your Data
Your app need place to keep account info after e load. Think am like your app short-term memory - to hold current user data. Add dis line for top of your `app.js`:
```javascript
// Dis dey hold di current user account data
let account = null;
```
**Why we need am:**
- Make data dey accessible from anywhere for app
- Start wit `null` mean say "no person login yet"
- E go update wen person login or register well
- Na single source of truth - no confusion who log in
#### Step 5: Wire Up Your Form
Now make we connect your sharp new login function to HTML form. Update your form tag like dis:
```html
<form id="loginForm" action="javascript:login()">
<!-- Your existing form inputs -->
</form>
```
**Wetin dis small change do:**
- Stop form from reloading whole page by default
- Call your custom JavaScript function instead
- Make everything smooth like single-page app
- Make you get full control of wetin happen wen users click "Login"
#### Step 6: Enhance Your Registration Function
For balance, update your `register` function to also save account data and go dashboard:
```javascript
// Add dis lines for di end of your register function
account = result;
navigate('/dashboard');
```
**Dis upgrade give:**
- **Smooth** change from registration to dashboard
- **Consistent** user experience for login and registration
- **Quick** access to account data after registration
#### Testing Your Implementation
```mermaid
flowchart TD
A[User put credentials] --> B[Login function call]
B --> C[Fetch account data from server]
C --> D{Data reach inside well?}
D -->|Yes| E[Store account data everywhere]
D -->|No| F[Show error message]
E --> G[Go dashbɔ̀d]
F --> H[User remain for login page]
```
**Time to test am:**
1. Make new account to check if e work
2. Try to login wit dat same info
3. Check your browser console (F12) if any wahala show
4. Make sure say you land dashboard after login success
If e no work, no panic! Most wahala na small mistakes like typo or you forget start API server.
#### A Quick Word About Cross-Origin Magic
You fit dey wonder: "How my web app dey talk to dis API server wen dem dey for different ports?" Correct question! Dis na wetin every web developer go face.
> 🔒 **Cross-Origin Security**: Browsers get "same-origin policy" to stop unauthorized talk between different domains. Like checkpoint for Pentagon, dem go verify before allow communication.
>
**For our setup:**
- Your web app dey `localhost:3000` (development server)
- Your API server dey `localhost:5000` (backend server)
- API server get [CORS headers](https://developer.mozilla.org/docs/Web/HTTP/CORS) wey allow communication from your web app
Dis na real-world setup where frontend and backend dey run on different servers.
> 📚 **Learn More**: Make you dive deeper into APIs and data fetching wit dis wide [Microsoft Learn module on APIs](https://docs.microsoft.com/learn/modules/use-apis-discover-museum-art/?WT.mc_id=academic-77807-sagibbon).
## Bringing Your Data to Life in HTML
Now we go make di fetched data visible to users through DOM manipulation. Like developing photos for darkroom, we dey turn invisible data to something wey users fit see and interact with.
Manipulation for DOM na di technique wey dey turn static web pages to dynamic applications wey go dey update dia content based on how users interact and server responses.
### How to Choose Di Correct Tool for Di Work
When you wan update your HTML wit JavaScript, you get plenty options. Think am like different tools inside toolbox - each one dey perfect for certain kind work:
| Method | Wetin e good for | When to use am | Safety level |
|--------|------------------|----------------|--------------|
| `textContent` | Display user data wey safe | Anytime you dey show text | ✅ Solid well well |
| `createElement()` + `append()` | Build complex layouts | When you wan create new sections/lists | ✅ Bulletproof |
| `innerHTML` | Set HTML content | ⚠️ Try to avoid am | ❌ Risky wahala |
#### Di Safe Way to Show Text: textContent
Di [`textContent`](https://developer.mozilla.org/docs/Web/API/Node/textContent) property na your best padi when you dey show user data. E be like bouncer for your webpage - nothing wey fit harm fit pass:
```javascript
// Di safe, correct way to update text
const balanceElement = document.getElementById('balance');
balanceElement.textContent = account.balance;
```
**Benefits of textContent:**
- Treat everything as plain text (no let script run)
- Automatically clear old content
- Sharp sharp for simple text update
- Get security inside to protect against bad content
#### How to Create Dynamic HTML Elements
For more complex content, join [`document.createElement()`](https://developer.mozilla.org/docs/Web/API/Document/createElement) with [`append()`](https://developer.mozilla.org/docs/Web/API/ParentNode/append) method:
```javascript
// Beta way to make new tin dem
const transactionItem = document.createElement('div');
transactionItem.className = 'transaction-item';
transactionItem.textContent = `${transaction.date}: ${transaction.description}`;
container.append(transactionItem);
```
**How this style work:**
- **Create** new DOM elements wit code
- **Keep** full control for element attributes and content
- **Allow** make complex, nested element structure
- **Save** security by separating structure from content
> ⚠️ **Security Matter**: Although [`innerHTML`](https://developer.mozilla.org/docs/Web/API/Element/innerHTML) dey for many tutorials, e fit run script wey dey inside. Just like CERN get security wey no dey allow unauthorized code, using `textContent` and `createElement` na safer option.
>
**Risk for innerHTML:**
- E fit run any `<script>` wey dey user data
- Easy to get code injection attack
- Fit cause security wahala
- Safer options like we dey use get same kain power to work
### Make Errors Dey User-Friendly
As e dey now, login errors dey only show for browser console wey users no fit see. Na like pilot own internal diagnostic and passenger info system. We need to tell users important thing for correct way.
If error message dey visible, e go give user quick feedback about wetin spoil and how dem go take fix am.
#### Step 1: Add Place for Error Messages
First, mek we give error messages place for your HTML. Put am before your login button so users go fit see am naturally:
```html
<!-- This is where error messages will appear -->
<div id="loginError" role="alert"></div>
<button>Login</button>
```
**Wetin dey happen here:**
- We dey create empty container wey no dey visible until e need shine
- E dey where users go naturally look after dem click "Login"
- That `role="alert"` na correct touch for screen readers - e dey tell assistive technology say "hey, this one important!"
- The unique `id` dey make am easy for our JavaScript target am
#### Step 2: Create Better Helper Function
Make we create small utility function wey fit update any element text. Na one of those "write once, use everywhere" function wey go save your time:
```javascript
function updateElement(id, text) {
const element = document.getElementById(id);
element.textContent = text;
}
```
**Function benefits:**
- Simple way wey need only element ID and text content
- Find DOM elements safely and update dem
- Pattern wey fit take reduce code copy paste
- Dey keep update behavior consistent across app
#### Step 3: Show Errors Where User Fit See
Now mek we change that hidden console message to something user fit see. Update your login function:
```javascript
// Instead of just logging to console, show di user wetin wrong dey
if (data.error) {
return updateElement('loginError', data.error);
}
```
**This small change get big effect:**
- Error messages dey show for place users dey look
- No more silent quiet failure
- Users go get immediate feedback wey dem fit act on
- Your app go dey professional and well thought out
Now if you test wit wrong account, you go see helpful error message well for page!
![Screenshot showing the error message displayed during login](../../../../translated_images/login-error.416fe019b36a6327.pcm.png)
#### Step 4: Make E Inclusive wit Accessibility
One correct thing about that `role="alert"` we add before be say e no just dey decorate! This small attribute dey create wetin dem dey call [Live Region](https://developer.mozilla.org/docs/Web/Accessibility/ARIA/ARIA_Live_Regions) wey go immediately announce changes to screen readers:
```html
<div id="loginError" role="alert"></div>
```
**Why e matter:**
- Screen reader users go hear error message as soon as e show
- Everybody go get same important info no matter how dem dey use app navigate
- Na simple way to make your app dey work for more people
- E show say you care to make inclusive experience
Small touch like this na wetin separate good developers from better ones!
### 🎯 Pedagogical Check-in: Authentication Patterns
**Pause and Reflect**: You don just put correct authentication flow. Na foundation pattern for web development.
**Quick Self-Assessment**:
- You fit explain why we dey use async/await for API calls?
- Wetin go happen if we forget to use `encodeURIComponent()` function?
- How our error handling dey improve user experience?
**Real-World Connection**: Patterns wey you learn here (async data fetching, error handling, user feedback) dey everywhere for major web apps from social media to e-commerce sites. Na production-level skill you dey build!
**Challenge Question**: How you fit change this authentication system to handle many user roles (customer, admin, teller)? Think about data structure and UI changes wey go need.
#### Step 5: Apply Same Style for Registration
For consistency, put same error handling pattern for your registration form:
1. **Add** error display element inside your registration HTML:
```html
<div id="registerError" role="alert"></div>
```
2. **Update** your register function to use same error display style:
```javascript
if (data.error) {
return updateElement('registerError', data.error);
}
```
**Benefits of consistent error handling:**
- **Give** uniform user experience for all forms
- **Reduce** brain pain by using familiar patterns
- **Make** maintenance easy with reusable code
- **Ensure** app meet accessibility standards well well
## How to Create Your Dynamic Dashboard
Now we go turn your static dashboard to dynamic interface wey dey show real account data. Just like printed flight schedule different from live departure boards for airports, we dey move from static info to real-time display wey dey respond.
Using DOM manipulation techniques wey you don learn, we go create dashboard wey go dey automatically update with current account info.
### Get to Know Your Data
Before we start to build, make we look wetin kind data your server dey send back. When person login correct, this na the kind info you go get:
```json
{
"user": "test",
"currency": "$",
"description": "Test account",
"balance": 75,
"transactions": [
{ "id": "1", "date": "2020-10-01", "object": "Pocket money", "amount": 50 },
{ "id": "2", "date": "2020-10-03", "object": "Book", "amount": -10 },
{ "id": "3", "date": "2020-10-04", "object": "Sandwich", "amount": -5 }
]
}
```
**This data structure get:**
- **`user`**: Perfect for personalize experience ("Welcome back, Sarah!")
- **`currency`**: Make sure money amounts dey display correct
- **`description`**: Friendly name for account
- **`balance`**: Important current balance amount
- **`transactions`**: Complete transaction history with all details
Everything you need to build pro bank dashboard!
```mermaid
flowchart TD
A[User Login] --> B[Fetch Account Data]
B --> C{Data Valid?}
C -->|Yes| D[Put for Global Variable]
C -->|No| E[Show Error Message]
D --> F[Go Dashboard]
F --> G[Update UI Elements]
G --> H[Show Balance]
G --> I[Show Description]
G --> J[Render Transactions]
J --> K[Make Table Rows]
K --> L[Format Currency]
L --> M[User Dey see Live Data]
```
> 💡 **Pro Tip**: You want see your dashboard sharp sharp? Use username `test` when you login - e get sample data already loaded so you fit see everything dey work without creating transactions first.
>
**Why test account dey handy:**
- Get realistic sample data loaded already
- Perfect to see how transactions go display
- Great for testing dashboard features
- E go save you time from making dummy data by hand
### How to Create Dashboard Display Elements
Lets build your dashboard step by step, start with account summary info and then move to complex parts like transaction lists.
#### Step 1: Update Your HTML Structure
First, change static "Balance" section to dynamic placeholder elements wey your JavaScript fit fill:
```html
<section>
Balance: <span id="balance"></span><span id="currency"></span>
</section>
```
Next, add section for account description. Since this go act like title for dashboard content, use correct semantic HTML:
```html
<h2 id="description"></h2>
```
**How HTML structure work:**
- **Use** separate `<span>` elements for balance and currency so e fit get individual control
- **Apply** unique IDs for each element so JavaScript fit target dem
- **Follow** semantic HTML by using `<h2>` for account description
- **Create** logical hierarchy for screen readers and SEO
> ✅ **Accessibility Insight**: Account description na title for dashboard content, so e dey marked properly as heading. Learn more about how [heading structure](https://www.nomensa.com/blog/2017/how-structure-headings-web-accessibility) affect accessibility. You fit identify other elements for your page wey need heading tags?
#### Step 2: Create Dashboard Update Function
Now create function wey go fill your dashboard with real account data:
```javascript
function updateDashboard() {
if (!account) {
return navigate('/login');
}
updateElement('description', account.description);
updateElement('balance', account.balance.toFixed(2));
updateElement('currency', account.currency);
}
```
**Step by step, what this function dey do:**
- **Check** if account data dey before e proceed
- **Redirect** unauthenticated users go login page
- **Update** account description using reusable `updateElement` function
- **Format** balance to always show two decimal places
- **Show** appropriate currency symbol
> 💰 **Money Formatting**: That [`toFixed(2)`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number/toFixed) method na lifesaver! E sure your balance always look like real money - "75.00" no be just "75". Users go like seeing proper currency format.
#### Step 3: Make Sure Your Dashboard Update
To make sure dashboard dey fresh with current data anytime person go visit am, we need to connect to your navigation system. If you don do [lesson 1 assignment](../1-template-route/assignment.md), this go be familiar. If no, no worry - here na wetin you need:
Add this to your `updateRoute()` function end:
```javascript
if (typeof route.init === 'function') {
route.init();
}
```
Then update your routes to include dashboard setup:
```javascript
const routes = {
'/login': { templateId: 'login' },
'/dashboard': { templateId: 'dashboard', init: updateDashboard }
};
```
**How this setup sabi work:**
- Check if route get special initialization code
- Run that code automatically when route load
- Make sure your dashboard dey show fresh, current data
- Keep your routing logic clean and organised
#### Test Your Dashboard
After all this change, test your dashboard:
1. **Login** with test account
2. **Confirm** say you redirect go dashboard
3. **Check** if account description, balance, and currency dey show correct
4. **Try logout and login again** to make sure data dey refresh well
Your dashboard now fit display dynamic account info wey update based on logged-in user data!
## Build Smart Transaction Lists with Templates
Instead of you dey create HTML manually for each transaction, we go use templates to generate consistently formatted rows automatically. Just like standardized parts for spacecraft, templates make sure every transaction row get same structure and look.
This way fit scale sharp from few transactions to thousands without wahala, still keep performance and look consistent.
```mermaid
graph LR
A[HTML Template] --> B[JavaScript Clone]
B --> C[Populate with Data]
C --> D[Add to Fragment]
D --> E[Batch Insert to DOM]
subgraph "Performance Benefits"
F[One DOM Update]
G[Correct Format]
H[Fit Use Pattern]
end
E --> F
E --> G
E --> H
```
```mermaid
flowchart LR
A[Transaction Data] --> B[HTML Template]
B --> C[Clone Template]
C --> D[Put Data inside am]
D --> E[Add am to DOM]
E --> F[Do am again for Every Transaction]
```
### Step 1: Create Transaction Template
First, add reusable template for transaction rows inside your HTML `<body>`:
```html
<template id="transaction">
<tr>
<td></td>
<td></td>
<td></td>
</tr>
</template>
```
**How HTML templates work:**
- **Define** structure for one table row
- **Remain** invisible till clone and populate with JavaScript
- **Get** three cells for date, description, and amount
- **Provide** reusable pattern for consistent look
### Step 2: Prepare Table for Dynamic Content
Next, add `id` to your tbody so JavaScript fit easily target am:
```html
<tbody id="transactions"></tbody>
```
**What this one do:**
- **Create** clear target to insert transaction rows
- **Separate** table structure from dynamic content
- **Allow** easy clearing and refilling of transaction data
### Step 3: Build Transaction Row Factory Function
Now create function to change transaction data to HTML elements:
```javascript
function createTransactionRow(transaction) {
const template = document.getElementById('transaction');
const transactionRow = template.content.cloneNode(true);
const tr = transactionRow.querySelector('tr');
tr.children[0].textContent = transaction.date;
tr.children[1].textContent = transaction.object;
tr.children[2].textContent = transaction.amount.toFixed(2);
return transactionRow;
}
```
**How factory function work:**
- **Find** template element by ID
- **Clone** template content for safe work
- **Select** table row inside cloned content
- **Fill** each cell with transaction data
- **Format** amount to show correct decimal places
- **Return** ready row to insert
### Step 4: Generate Multiple Transaction Rows Fast
Add this code to your `updateDashboard()` function so e go display all transactions:
```javascript
const transactionsRows = document.createDocumentFragment();
for (const transaction of account.transactions) {
const transactionRow = createTransactionRow(transaction);
transactionsRows.appendChild(transactionRow);
}
updateElement('transactions', transactionsRows);
```
**How this efficient approach work:**
- **Create** document fragment to batch DOM operations
- **Loop** through all transactions in account data
- **Make** row for each transaction with factory function
- **Collect** all rows in fragment before adding to DOM
- **Do** one big DOM update instead of many small ones
> ⚡ **Performance Optimization**: [`document.createDocumentFragment()`](https://developer.mozilla.org/docs/Web/API/Document/createDocumentFragment) dey work like how dem dey assemble plane for Boeing - components dem dey prepare for sidon off the main line, den dem go install am as one complete unit. Dis kind batching approach dey minimize DOM reflows by to just do one insertion instead of to dey do plenty separate operations.
### Step 5: Make Update Function Better for Mixed Content
Your `updateElement()` function now na im dey handle only text content. Make you update am to make e fit work with both text and DOM nodes:
```javascript
function updateElement(id, textOrNode) {
const element = document.getElementById(id);
element.textContent = ''; // Comot all di pikin them
element.append(textOrNode);
}
```
**Key improvements for this update be:**
- **E clear** the content wey dey before before as e add new content
- **E accept** text strings or DOM nodes as parameters
- **E use** the [`append()`](https://developer.mozilla.org/docs/Web/API/ParentNode/append) method for more flexibility
- **E still get** backward compatibility with old text-based way of using am
### Make You Test Your Dashboard
Time don reach for the moment of truth! Make we see how your dynamic dashboard dey work:
1. Login with `test` account (e get sample data ready)
2. Go your dashboard
3. Check say transaction rows dey appear with correct format
4. Make sure say dates, descriptions, and amounts dem look well
If everything dey work, you go see full transaction list wey dey work well for your dashboard! 🎉
**Wetin you don achieve:**
- You don build dashboard wey fit handle any amount of data
- You create reusable templates to keep format consistent
- You use better DOM manipulation skills
- You build functionality wey fit compete with production banking apps
You don convert static webpage come dynamic web application successfully.
### 🎯 Pedagogical Check-in: How You Take Generate Dynamic Content
**How System Arrange E:** You don create better data-to-UI pipeline wey dey similar to wetin frameworks like React, Vue, and Angular dey use.
**Main Concepts We You Don Learn:**
- **Template-based rendering**: To create reusable UI components
- **Document fragments**: To optimize DOM performance
- **Safe DOM manipulation**: Make e no get security problem
- **Data transformation**: Convert server data make e become user interface
**Industry Connection:** Dis kain skills na wetin modern frontend frameworks base on. React virtual DOM, Vue template system and Angular component architecture na all dis main ideas dey build on top.
**Reflection Question:** How you fit make system fit handle real-time updates (like when new transactions show automatically)? Think WebSockets or Server-Sent Events.
---
## 📈 Your Data Management Mastery Timeline
```mermaid
timeline
title Data-Driven Development Journey
section Foundation Building
API Setup & Testing
: Understand client-server communication
: Master HTTP request/response cycle
: Learn debugging techniques
section Authentication Mastery
Async Function Patterns
: Write clean async/await code
: Handle promises effectively
: Implement error boundaries
User Session Management
: Create global state patterns
: Build navigation guards
: Design user feedback systems
section Dynamic UI Development
Safe DOM Manipulation
: Prevent XSS vulnerabilities
: Use textContent over innerHTML
: Create accessibility-friendly interfaces
Template Systems
: Build reusable UI components
: Optimize performance with fragments
: Scale to handle large datasets
section Professional Patterns
Production-Ready Code
: Implement comprehensive error handling
: Follow security best practices
: Create maintainable architectures
Modern Web Standards
: Master Fetch API patterns
: Understand CORS configurations
: Build responsive, accessible UIs
```
**🎓 Graduation Milestone:** You don successfully build data-driven web application using modern JavaScript patterns. This kin skills fit directly use for frameworks like React, Vue or Angular.
**🔄 Next Level Skills:**
- You ready to explore frontend frameworks wey go build on these ideas
- You fit add real-time features wit WebSockets
- You get skill to build Progressive Web Apps wey fit work offline
- You get foundation for to dey learn advanced state management patterns
## GitHub Copilot Agent Challenge 🚀
Use Agent mode do this challenge:
**Description:** Make the banking app beta with search and filter feature so dat users fit find specific transactions by date range, amount or description.
**Prompt:** Create search functionality for banking app wey get: 1) Search form with input fields for date range (from/to), minimum/maximum amount, and transaction description keywords; 2) `filterTransactions()` function wey go filter account.transactions array based on search criteria; 3) Update `updateDashboard()` function to show filtered results; 4) Add a "Clear Filters" button to reset view. Use modern JavaScript array methods like `filter()` and handle corner cases for empty search criteria.
Learn more about [agent mode](https://code.visualstudio.com/blogs/2025/02/24/introducing-copilot-agent-mode) here.
## 🚀 Challenge
You ready to take your banking app go next level? Make e dey look and feel as someting wey you really wan use. Here na some ideas to help your creativity:
**Make am fine:** Add CSS styling to make dashboard wey actually fine to look. Think clean lines, good spacing, and maybe small animations too.
**Make am respond well:** Try use [media queries](https://developer.mozilla.org/docs/Web/CSS/Media_Queries) to build [responsive design](https://developer.mozilla.org/docs/Web/Progressive_web_apps/Responsive/responsive_design_building_blocks) wey fit run well for phones, tablets and desktops. Your users go thank you!
**Add small style:** Try dey color code transactions (green for income, red for expense), add icons, or create hover effects wey go make interface dey interactive.
See how better dashboard fit look:
![Screenshot of an example result of the dashboard after styling](../../../../translated_images/screen2.123c82a831a1d14a.pcm.png)
No feel say you suppose copy am exactly - use am for inspiration and do your own style!
## Post-Lecture Quiz
[Post-lecture quiz](https://ff-quizzes.netlify.app/web/quiz/46)
## Assignment
[Refactor and comment your code](assignment.md)
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis dokument na im dey translate wit AI translation service wey dem call [Co-op Translator](https://github.com/Azure/co-op-translator). Even though we dey try make am correct, abeg sabi say automated translation fit get mistake or no too exact. Di original dokument wey e original language na di correct source. If na serious matter, better make human expert translate am. We no go responsible if pesin no understandwell or mistake come because of dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,144 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "d0a02cb117e91a5b5f24178080068a3d",
"translation_date": "2026-01-08T17:28:04+00:00",
"source_file": "7-bank-project/3-data/assignment.md",
"language_code": "pcm"
}
-->
# Code Refactoring and Documentation Assignment
## Learning Objectives
By completing dis assignment, you go practice important software development skills wey professional developers dey use every day. You go learn how to organize code make e dey easy to maintain, reduce repetition through abstraction, and write documentation for your work so future developers (including yourself!) fit understand.
Clean, well-documented code dey very important for real-world web development projects wey multiple developers dey collaborate and codebases dey change over time.
## Assignment Overview
Your banking app `app.js` file don grow well well with login, registration, and dashboard functionalities. Na time to refactor this code using professional development methods to improve how e dey read, maintain, and to reduce duplication.
## Instructions
Transform your current `app.js` code by implementing these three core refactoring techniques:
### 1. Extract Configuration Constants
**Task**: Create one configuration section for the top of your file with reusable constants.
**Implementation guidance:**
- Extract the server API base URL (wey you don hardcode for multiple places)
- Make constants for error messages wey dey appear for many functions
- Fit consider extracting route paths and element IDs wey you dey use too many times
**Example structure:**
```javascript
// Konfigureshon konstants
const API_BASE_URL = 'http://localhost:5000/api';
const ROUTES = {
LOGIN: '/login',
DASHBOARD: '/dashboard'
};
```
### 2. Create a Unified Request Function
**Task**: Build one reusable function wey be `sendRequest()` wey go kill duplicate code between `createAccount()` and `getAccount()`.
**Requirements:**
- Fit handle both GET and POST requests
- Get proper error handling
- Support different URL endpoints
- Accept optional request body data
**Function signature guidance:**
```javascript
async function sendRequest(endpoint, method = 'GET', data = null) {
// Your implementation dey here
}
```
### 3. Add Professional Code Documentation
**Task**: Make documentation for your code with clear, helpful comments wey go explain the "why" behind your logic.
**Documentation standards:**
- Add function documentation wey explain purpose, parameters, and return values
- Put inline comments for complex logic or business rules
- Group related functions together with section headers
- Explain any code wey no obvious or browser-specific workarounds
**Example documentation style:**
```javascript
/**
* Authenticates user and redirects to dashboard
* @param {Event} event - Form submission event
* @returns {Promise<void>} - Resolves when login process completes
*/
async function login(event) {
// Make e no submit form automatically, make JavaScript handle am
event.preventDefault();
// How you go do am...
}
```
## Success Criteria
Your refactored code suppose show these professional development practices:
### Exemplary Implementation
- ✅ **Constants**: All magic strings and URLs don extract into clearly named constants
- ✅ **DRY Principle**: Common request logic don consolidate inside one reusable `sendRequest()` function
- ✅ **Documentation**: Functions get clear JSDoc comments wey explain purpose and parameters
- ✅ **Organization**: Code dey logically grouped with section headers and consistent formatting
- ✅ **Error Handling**: Improved error handling through the new request function
### Adequate Implementation
- ✅ **Constants**: Most repeated values don extract, but small hardcoded values still dey
- ✅ **Factorization**: Basic `sendRequest()` function don create but maybe e no cover all edge cases
- ✅ **Comments**: Key functions get documentation, but some explanations fit dey more detailed
- ✅ **Readability**: Code generally well-organized but some areas fit improve
### Needs Improvement
- ❌ **Constants**: Plenty magic strings and URLs still hardcode everywhere inside the file
- ❌ **Duplication**: Plenty code duplication still dey between similar functions
- ❌ **Documentation**: Comments dey missing or no clear to explain code purpose
- ❌ **Organization**: Code no get clear structure or logical grouping
## Testing Your Refactored Code
After you don refactor, make sure say your banking app still dey work well:
1. **Test all user flows**: Registration, login, dashboard display, and error handling
2. **Verify API calls**: Confirm say your `sendRequest()` function dey work for both account creation and retrieval
3. **Check error scenarios**: Test with invalid credentials and network errors
4. **Review console output**: Make sure no new errors don appear during refactoring
## Submission Guidelines
Submit your refactored `app.js` file with:
- Clear section headers wey organize different functionality
- Consistent code formatting and indentation
- Complete JSDoc documentation for all functions
- One short comment for the top wey explain your refactoring approach
**Bonus Challenge**: Create one simple code documentation file (`CODE_STRUCTURE.md`) wey go explain your app architecture and how different functions dey work together.
## Real-World Connection
This assignment na like the kind code maintenance wey professional developers dey do regularly. For industry:
- **Code reviews** dey check readability and maintainability like dis assignment
- **Technical debt** dey increase when code no dey refactor and document regularly
- **Team collaboration** depend on clear, well-documented code wey new team members fit understand
- **Bug fixes** easy well well for well-organized codebase wey get proper abstraction
The skills you dey practice here - extracting constants, killing duplication, and writing clear documentation - na the basic things for professional software development.
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document don translate wit AI translation service wey dem dey call [Co-op Translator](https://github.com/Azure/co-op-translator). Even though we dey try make am correct, abeg sabi say automated translation fit get mistake or no too correct. Di original document wey dey dia for e original language na di correct one. If na serious tin, e better make human professional translate am. We no go take blame if pesin no understand well or misinterpret tins from dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,811 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "b807b09df716dc48a2b750835bf8e933",
"translation_date": "2026-01-08T17:33:42+00:00",
"source_file": "7-bank-project/4-state-management/README.md",
"language_code": "pcm"
}
-->
# Build a Banking App Part 4: Concepts of State Management
## ⚡ Wetin You Fit Do for Di Next 5 Minutes
**Quick Start Pathway for Busy Developers**
```mermaid
flowchart LR
A[⚡ 5 minutes] --> B[Diagnose state wahala]
B --> C[Create central state object]
C --> D[Add updateState function]
D --> E[See immediate improvements]
```
- **Minute 1**: Test di current state wahala - log in, refresh page, see logout
- **Minute 2**: Change `let account = null` to `let state = { account: null }`
- **Minute 3**: Make one simple `updateState()` function for controlled updates
- **Minute 4**: Change one function to use di new pattern
- **Minute 5**: Test di better predictability and debugging power
**Quick Diagnostic Test**:
```javascript
// Before: Scatter state
let account = null; // Lost when you refresh!
// After: Centralize state
let state = Object.freeze({ account: null }); // Control and fit track am!
```
**Why This Matters**: For 5 minutes, you go experience di change from chaotic state management go predictable, debuggable patterns. Na dis foundation wey make complex apps fit still dey manageable.
## 🗺️ Your Learning Journey Through State Management Mastery
```mermaid
journey
title From Scattered State to Professional Architecture
section Diagnosing Problems
Identify state loss issues: 3: You
Understand scattered updates: 4: You
Recognize architecture needs: 6: You
section Centralizing Control
Create unified state object: 5: You
Implement controlled updates: 7: You
Add immutable patterns: 8: You
section Adding Persistence
Implement localStorage: 6: You
Handle serialization: 7: You
Create session continuity: 9: You
section Balancing Freshness
Address data staleness: 5: You
Build refresh systems: 8: You
Achieve optimal balance: 9: You
```
**Your Journey Destination**: By di end of dis lesson, you go build professional-grade state management system wey dey handle persistence, data freshness, and predictable updates - na di same pattern wey production apps dey use.
## Pre-Lecture Quiz
[Pre-lecture quiz](https://ff-quizzes.netlify.app/web/quiz/47)
## Introduction
State management be like di navigation system wey dey for Voyager spacecraft when everything dey work smooth, you no go too notice am. But when wahala show, na im go make difference between reaching interstellar space and drifting lost for cosmic void. For web development, state mean everything wey your app need to remember: user login status, form data, navigation history, and temporary interface states.
As your banking app don grow from simple login form to more advanced application, you for already meet some common challenges. You refresh page, users dey logout unexpectedly. You close browser, progress disappear. You want debug problem, you dey search many functions wey dey change di same data in different ways.
Dis no mean say coding bad na nature wahala wey show anytime app reach certain level of complexity. Every developer dey face dis kind challenge as dem app dey change from "proof of concept" to "production ready."
For dis lesson, we go implement centralized state management system wey go turn your banking app to reliable, professional application. You go learn how to manage data flows predictably, keep user sessions correct, and make smooth user experience wey modern web apps need.
## Prerequisites
Before you dive into state management concepts, you need get your development environment set up well and your banking app base ready. Dis lesson dey build directly on concepts and code wey dey previous parts of dis series.
Make sure say you get dis things ready before you continue:
**Required Setup:**
- Complete di [data fetching lesson](../3-data/README.md) - your app suppose fit load and display account data well
- Install [Node.js](https://nodejs.org) for your system to run backend API
- Start di [server API](../api/README.md) locally to handle account data work
**Testing Your Environment:**
Make sure say your API server dey run correct by running dis command for terminal:
```sh
curl http://localhost:5000/api
# -> e suppose return "Bank API v1.0.0" as result
```
**Wetin dis command dey do:**
- **Send** GET request to your local API server
- **Test** connection and check if server dey respond
- **Return** API version info if everything dey work right
## 🧠 State Management Architecture Overview
```mermaid
mindmap
root((State Management))
Current Problems
Session Loss
Page Refresh Issues
Browser Close Impact
Variable Reset Problems
Scattered Updates
Multiple Modification Points
Debugging Challenges
Unpredictable Behavior
Incomplete Cleanup
Logout State Issues
Memory Leaks
Security Concerns
Centralized Solutions
Unified State Object
Single Source of Truth
Predictable Structure
Scalable Foundation
Controlled Updates
Immutable Patterns
Object.freeze Usage
Function-Based Changes
State Tracking
History Management
Debug Visibility
Change Auditing
Persistence Strategies
localStorage Integration
Session Continuity
JSON Serialization
Automatic Sync
Data Freshness
Server Refresh
Stale Data Handling
Balance Optimization
Storage Optimization
Minimal Data
Performance Focus
Security Considerations
```
**Core Principle**: Professional state management dey balance predictability, persistence, and performance to create reliable user experiences wey fit scale from simple interactions to complex app workflows.
---
## Diagnosing the Current State Issues
Like Sherlock Holmes wey dey inspect crime scene, we need understand wetin exactly dey happen for current implementation before we fit solve di mystery of disappearing user sessions.
Make we do simple experiment wey go show di main state management wahala:
**🧪 Try This Diagnostic Test:**
1. Log into your banking app and go dashboard
2. Refresh browser page
3. Observe wetin happen to your login status
If you carry you redirect back to login screen, you don find di classic state persistence problem. Dis one happen because our current implementation dey store user data for JavaScript variables wey dey reset anytime page load.
**Current Implementation Problems:**
Di simple `account` variable wey we get for our [previous lesson](../3-data/README.md) dey cause three big wahala wey affect both user experience and code maintainability:
| Wahala | Technical Cause | User Impact |
|---------|--------|----------------|
| **Session Loss** | Page refresh dey clear JavaScript variables | Users go dey re-authenticate every now and then |
| **Scattered Updates** | Many functions dey change state directly | Debugging go dey harder and harder |
| **Incomplete Cleanup** | Logout no dey clear all state references | Potential security and privacy wahala |
**The Architectural Challenge:**
Like how Titanic get compartment system wey look strong until plenty compartments fill with water at once, to fix dis problems one by one no go solve di main architectural problem. We need big state management solution.
> 💡 **Wetin we really dey try do here?**
[State management](https://en.wikipedia.org/wiki/State_management) na to solve two main puzzles:
1. **Where's My Data?**: Make we sabi wetin information we get and where e come from
2. **Is Everyone on the Same Page?**: Make sure wetin users see na wetin dey really happen
**Our Game Plan:**
Instead to dey run round everywhere, we go create **centralized state management** system. Think am like one organized person wey dey control everything wey important:
![Schema showing the data flows between the HTML, user actions and state](../../../../translated_images/data-flow.fa2354e0908fecc8.pcm.png)
```mermaid
flowchart TD
A[User Action] --> B[Event Handler]
B --> C[updateState Function]
C --> D{State Validation}
D -->|Valid| E[Create New State]
D -->|Invalid| F[Error Handling]
E --> G[Object.freeze]
G --> H[Update localStorage]
H --> I[Trigger UI Update]
I --> J[User Sees Changes]
F --> K[User Sees Error]
subgraph "State Management Layer"
C
E
G
end
subgraph "Persistence Layer"
H
L[localStorage]
H -.-> L
end
```
**Understand dis data flow:**
- **Centralize** all application state for one place
- **Route** all state changes through controlled functions
- **Ensure** UI dey synchronized with current state
- **Provide** clear, predictable pattern for data management
> 💡 **Professional Insight**: Dis lesson na fundamentals. For complex apps, libraries like [Redux](https://redux.js.org) get more advanced state management features. If you understand core principle dem, you go fit master any state management library.
> ⚠️ **Advanced Topic**: We no go talk about automatic UI updates wey dey happen because of state changes, as dis one na [Reactive Programming](https://en.wikipedia.org/wiki/Reactive_programming) matter. You fit take am as next level for your learning journey!
### Task: Centralize State Structure
Make we start to transform our scattered state management into one centralized system. Dis first step go build foundation for all di better things wey dem go follow.
**Step 1: Create a Central State Object**
Change di simple `account` declaration for:
```js
let account = null;
```
To structured state object:
```js
let state = {
account: null
};
```
**Why dis change matter:**
- **Centralize** all app data for one place
- **Prepare** structure to add more state properties later
- **Create** clear boundary between state and other variables
- **Build** pattern wey fit grow as your app dey grow
**Step 2: Update State Access Patterns**
Change your functions to use di new state structure:
**For `register()` and `login()` functions**, change this:
```js
account = ...
```
To dis one:
```js
state.account = ...
```
**For `updateDashboard()` function**, add dis line for top:
```js
const account = state.account;
```
**Wetin these updates dey do:**
- **Maintain** existing function but improve structure
- **Prepare** your code for advanced state management
- **Create** consistent patterns to access state data
- **Build** foundation for centralized state updates
> 💡 **Note**: Dis refactoring no solve all wahala immediately, but e go build strong foundation for better improvements wey go come!
### 🎯 Pedagogical Check-in: Centralization Principles
**Pause and Reflect**: You don just implement foundation for centralized state management. Na important architectural decision be dis.
**Quick Self-Assessment**:
- You fit talk why e good to centralize state inside one object, no scatter am for many variables?
- Wetin go happen if you forget to update function to use `state.account`?
- How dis pattern dey prepare your code for more advanced features?
**Real-World Connection**: Di centralization pattern wey you learn na di foundation for modern frameworks like Redux, Vuex, and React Context. You dey build the same architectural thinking wey big app dem dey use.
**Challenge Question**: If you want add user preferences (theme, language) for your app, where you go put am for state structure? How e go scale?
## Implementing Controlled State Updates
With state already centralized, di next step na to set controlled way for data changes. Dis one go make state changes dey predictable and debugging easy.
Main principle na like air traffic control: no multiple functions dey change state anyhow, but make all changes dey go through one controlled function. Dis pattern dey provide clear oversight of when and how data change.
**Immutable State Management:**
We go treat our `state` object as [*immutable*](https://en.wikipedia.org/wiki/Immutable_object), meaning say we no go dey change am directly. Each time we want change am, we go create new state object with updated data.
Though dis one fit look like e no dey efficient compared to direct change, e get better benefit for debugging, testing, and make app dey predictable.
**Benefits of immutable state management:**
| Benefit | Description | Impact |
|---------|-------------|--------|
| **Predictability** | Changes dey happen only through controlled functions | Debug and test go easy |
| **History Tracking** | Each state change get new object | Fit do undo/redo functions |
| **Side Effect Prevention** | No accidental changes | Avoid mysterious bugs |
| **Performance Optimization** | Easy to detect when state really change | Fit do efficient UI updates |
**JavaScript Immutability with `Object.freeze()`:**
JavaScript get [`Object.freeze()`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze) wey fit stop object changes:
```js
const immutableState = Object.freeze({ account: userData });
// Any try to change immutableState go throw error
```
**Wetin dey happen here:**
- **Stop** direct property assignment or deletion
- **Throw** error if modification try happen
- **Ensure** state changes must enter controlled functions
- **Create** clear contract how state go fit update
> 💡 **Deep Dive**: Learn difference between *shallow* and *deep* immutable objects for [MDN documentation](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze#What_is_shallow_freeze). To sabi dis difference na important for complex state structures.
```mermaid
stateDiagram-v2
[*] --> StateV1: Di fust state
StateV1 --> StateV2: updateState('account', newData)
StateV2 --> StateV3: updateState('account', anotherUpdate)
StateV3 --> StateV4: updateState('preferences', userSettings)
note right of StateV1
Object.freeze()
Immutable
Debuggable
end note
note right of StateV2
New object created
Previous state preserved
Predictable changes
end note
```
### Task
Make we create one new `updateState()` function:
```js
function updateState(property, newData) {
state = Object.freeze({
...state,
[property]: newData
});
}
```
For dis function, we dey create new state object and copy data from old state using [*spread (`...`) operator*](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Operators/Spread_syntax#Spread_in_object_literals). Then we dey override one particular property of state with new data using [bracket notation](https://developer.mozilla.org/docs/Web/JavaScript/Guide/Working_with_Objects#Objects_and_properties) `[property]` for assign. Finally, we dey lock the object to prevent change with `Object.freeze()`. Right now, we only get `account` property for state, but with dis method, you fit add as many properties as you want.
We also go update `state` initialization to make sure initial state sef dey frozen:
```js
let state = Object.freeze({
account: null
});
```
After that, update `register` function by replacing `state.account = result;` with:
```js
updateState('account', result);
```
Do same thing for `login`, replace `state.account = data;` with:
```js
updateState('account', data);
```
Now, we go take chance fix issue wey account data no dey clear when user click *Logout*.
Create new function `logout()`:
```js
function logout() {
updateState('account', null);
navigate('/login');
}
```
For `updateDashboard()`, replace redirection `return navigate('/login');` with `return logout()`;
Try register new account, logout, and log back in to check say everything still dey work well.
> Tip: You fit see all state changes by putting `console.log(state)` for bottom of `updateState()` and open console for your browser development tools.
## Implementing Data Persistence
Session loss wahala we identify earlier need persistence solution wey go keep user state across browser sessions. Dis one go turn our app from temporary experience to reliable, professional tool.
Think how atomic clocks dey keep precise time even during power failure by storing important state for non-volatile memory. Likewise, web apps need storage wey fit preserve key user data across browser sessions and page refresh.
**Strategic Questions for Data Persistence:**
Before you do persistence, reason these main questions:
| Question | Banking App Context | Decision Impact |
|----------|-------------------|----------------|
| **Is the data sensitive?** | Account balance, transaction history | Choose secure storage methods |
| **How long e go last?** | Login state vs. temporary UI preferences | Choose correct storage duration |
| **Server need am?** | Authentication tokens vs. UI settings | Decide if e go share |
**Browser Storage Options:**
Modern browsers get different storage ways wey dem build for different use:
**Primary Storage APIs:**
1. **[`localStorage`](https://developer.mozilla.org/docs/Web/API/Window/localStorage)**: Persistent [Key/Value storage](https://en.wikipedia.org/wiki/Key%E2%80%93value_database)
- **Data dey stay** across browser sessions forever
- **No lost** when browser or computer clear or restart
- **Na for** that one website domain only
- **Good** for user preferences and login states
2. **[`sessionStorage`](https://developer.mozilla.org/docs/Web/API/Window/sessionStorage)**: Temporary session storage
- **Works** the same as localStorage when session dey
- **Clear** when browser tab close
- **Perfect** for temporary data wey no suppose last
3. **[HTTP Cookies](https://developer.mozilla.org/docs/Web/HTTP/Cookies)**: Server-shared storage
- **Send** automatically with every server request
- **Good** for [authentication](https://en.wikipedia.org/wiki/Authentication) tokens
- **Small** size and fit slow performance
**Data Serialization Requirement:**
Both `localStorage` and `sessionStorage` dey store only [strings](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String):
```js
// Change objects to JSON strings make e fit store
const accountData = { user: 'john', balance: 150 };
localStorage.setItem('account', JSON.stringify(accountData));
// Turn JSON strings back to objects wen you dey find am out
const savedAccount = JSON.parse(localStorage.getItem('account'));
```
**How serialization dey work:**
- **Converts** JavaScript objects to JSON strings with [`JSON.stringify()`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify)
- **Transforms back** objects from JSON with [`JSON.parse()`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse)
- **Fit handle** complex nested objects and arrays automatically
- **No fit handle** functions, undefined values, and circular references
> 💡 **Advanced Option**: For complex offline apps with big data, try [`IndexedDB` API](https://developer.mozilla.org/docs/Web/API/IndexedDB_API). E be full client-side database but e need more complex implementation.
```mermaid
quadrantChart
title Browser Storage Options
x-axis Low Complexity --> High Complexity
y-axis Short Duration --> Long Duration
quadrant-1 Proffesionol Tools
quadrant-2 Simple Persistence
quadrant-3 Temporary Storage
quadrant-4 Advanced Systems
localStorage: [0.3, 0.8]
sessionStorage: [0.2, 0.2]
HTTP Cookies: [0.6, 0.7]
IndexedDB: [0.9, 0.9]
Memory Variables: [0.1, 0.1]
```
### Task: Build localStorage Persistence
Make we build persistent storage so people no go log out until dem do am purposely. We go use `localStorage` to store account data across browser sessions.
**Step 1: Define Storage Configuration**
```js
const storageKey = 'savedAccount';
```
**What dis constant dey do:**
- **Create** sure identifier for our stored data
- **Help avoid** typos for storage key
- **Easy to change** storage key if we need
- **Follow** good code practice
**Step 2: Add Automatic Persistence**
Put this line for the end of `updateState()` function:
```js
localStorage.setItem(storageKey, JSON.stringify(state.account));
```
**Wetin dis line dey do:**
- **Change** account object to JSON string for storage
- **Save** data with our storage key
- **Run** anytime state change happen
- **Make sure** stored data always correct with state
> 💡 **Architecture Benefit**: Because all state update na through `updateState()`, only one line of code to add persistence. This show how good architecture work!
**Step 3: Restore State on App Load**
Make initialization function to bring back saved data:
```js
function init() {
const savedAccount = localStorage.getItem(storageKey);
if (savedAccount) {
updateState('account', JSON.parse(savedAccount));
}
// Our previous initialization code na di one webin we start wit bifo
window.onpopstate = () => updateRoute();
updateRoute();
}
init();
```
**How initialization dey work:**
- **Get** any saved account data inside localStorage
- **Parse** JSON string back to JavaScript object
- **Update** state with controlled update function
- **Restore** user session automatically on page load
- **Run** before route changes to make state ready
**Step 4: Optimize Default Route**
Update default route to use persistence well:
For `updateRoute()`, replace:
```js
// Replace: return waka go('/login');
return navigate('/dashboard');
```
**Why this change dey okay:**
- **Use** new persistence system correctly
- **Let** dashboard handle authentication checks
- **Automatically** redirect to login if no session saved
- **Create** better user experience
**Testing Your Implementation:**
1. Login your banking app
2. Refresh browser page
3. Confirm say you still dey logged in and dashboard dey show
4. Close and open your browser again
5. Go back your app and check say you still dey logged in
🎉 **You Don Do Am!**: You don build correct persistent state management! Your app dey behave like professional web app now.
### 🎯 Pedagogical Check-in: Persistence Architecture
**Architecture Understanding**: You don create strong persistence layer wey balance user experience and data management.
**Key Concepts Mastered**:
- **JSON Serialization**: How to change complex objects to strings wey fit store
- **Automatic Synchronization**: State changes trigger storage save
- **Session Recovery**: App fit restore user context after interruption
- **Centralized Persistence**: One function handle all storage
**Industry Connection**: This persistence style na core for Progressive Web Apps (PWAs), offline-first apps, and modern mobile web apps. You dey build pro functionality.
**Reflection Question**: How you go take adjust am to handle many user accounts on one device? Think about privacy and security.
## Balancing Persistence with Data Freshness
Our persistence system dey keep user session well, but e bring wahala: data fit stale. When many users or apps change same server data, local cache go old.
Na like Viking sailors wey rely both on stored star charts and current sky observation. The charts give steady info but sailors still need fresh sight to dey correct for changes. Same way, our app need both persistent user state and current server data.
**🧪 Discovering Data Freshness Problem:**
1. Login dashboard with `test` account
2. Run dis command for terminal to simulate other source transaction:
```sh
curl --request POST \
--header "Content-Type: application/json" \
--data "{ \"date\": \"2020-07-24\", \"object\": \"Bought book\", \"amount\": -20 }" \
http://localhost:5000/api/accounts/test/transactions
```
3. Refresh your dashboard page for browser
4. See if new transaction show
**Wetin this test show:**
- **Show** how local storage fit become "stale" (old)
- **Simulate** real life wen data change comot for app
- **Show** tension between persistence and data freshness
**The Data Staleness Challenge:**
| Problem | Cause | User Impact |
|---------|-------|-------------|
| **Stale Data** | localStorage no dey expire automatically | Users dey see old info |
| **Server Changes** | Other users/apps modify same data | Views no dey consistent for different platform |
| **Cache vs. Reality** | Local cache no match server state | Bad user experience and confusion |
**Solution Strategy:**
We go do "refresh on load" pattern to balance persistence benefits with fresh data need. This go keep smooth experience and make sure data correct.
```mermaid
sequenceDiagram
participant U as User
participant A as App
participant L as localStorage
participant S as Server
U->>A: Open app
A->>L: Load di saved state
L-->>A: Return cached data
A->>U: Show UI sharp sharp
A->>S: Fetch fresh data
S-->>A: Return current data
A->>L: Update cache
A->>U: Update UI wit fresh data
```
### Task: Implement Data Refresh System
We go create system wey go automatically fetch fresh data from server while still keep our persistent state benefits.
**Step 1: Create Account Data Updater**
```js
async function updateAccountData() {
const account = state.account;
if (!account) {
return logout();
}
const data = await getAccount(account.user);
if (data.error) {
return logout();
}
updateState('account', data);
}
```
**How this function work:**
- **Check** if user logged in (state.account dey)
- **Redirect** to logout if no correct session
- **Fetch** fresh account data with existing `getAccount()` function
- **Handle** server errors softly by logging out invalid session
- **Update** state with fresh data using our controlled update way
- **Trigger** automatic localStorage save through `updateState()`
**Step 2: Create Dashboard Refresh Handler**
```js
async function refresh() {
await updateAccountData();
updateDashboard();
}
```
**What this refresh function do:**
- **Manage** data refresh and UI update
- **Wait** fresh data before update display
- **Make sure** dashboard dey show latest info
- **Keep** data management and UI updates separate
**Step 3: Integrate with Route System**
Change your route config to trigger refresh automatically:
```js
const routes = {
'/login': { templateId: 'login' },
'/dashboard': { templateId: 'dashboard', init: refresh }
};
```
**How this integration work:**
- **Run** refresh function every time dashboard route load
- **Make sure** fresh data dey any time user open dashboard
- **Keep** old route structure and add data freshness
- **Set** solid pattern for route init
**Testing Your Data Refresh System:**
1. Login your banking app
2. Run curl command earlier to add new transaction
3. Refresh dashboard page or go away come back
4. Confirm new transaction show sharp sharp
🎉 **Perfect Balance!** Your app combine smooth persistent state with fresh server data accuracy now!
## 📈 Your State Management Mastery Timeline
```mermaid
timeline
title Professional State Management Journey
section Problem Recognition
State Issues Diagnosis
: Identify session loss problems
: Understand scattered update issues
: Recognize architectural needs
section Architecture Foundation
Centralized State Design
: Create unified state objects
: Implement controlled update patterns
: Establish immutable principles
Predictable Updates
: Master Object.freeze() usage
: Build debug-friendly systems
: Create scalable patterns
section Persistence Mastery
localStorage Integration
: Handle JSON serialization
: Implement automatic synchronization
: Create session continuity
Data Freshness Balance
: Address staleness challenges
: Build refresh mechanisms
: Optimize performance vs accuracy
section Professional Patterns
Production-Ready Systems
: Implement error handling
: Create maintainable architectures
: Follow industry best practices
Advanced Capabilities
: Ready for framework integration
: Prepared for complex state needs
: Foundation for real-time features
```
**🎓 Graduation Milestone**: You don strong build complete state management system like Redux, Vuex, and other pro libraries. These patterns fit small app to big enterprise app.
**🔄 Next Level Skills**:
- Ready to master Redux, Zustand, Pinia and other state frameworks
- Prepared to do real-time with WebSockets
- Ready to build offline-first Progressive Web Apps
- Steady for advanced patterns like state machines and observers
## GitHub Copilot Agent Challenge 🚀
Use Agent mode to solve dis challenge:
**Description:** Build strong state management system wey get undo/redo for banking app. The challenge go help you practice advanced state ideas like history tracking, immutable updates, and UI sync.
**Prompt:** Make better state system wey get: 1) state history array to track past states, 2) undo/redo functions to reverse states, 3) UI buttons for undo/redo on dashboard, 4) max history limit of 10 to control memory, 5) clear history on logout. Make undo/redo work with account balance changes and still keep after browser refresh.
More info about [agent mode](https://code.visualstudio.com/blogs/2025/02/24/introducing-copilot-agent-mode) dey this link.
## 🚀 Challenge: Storage Optimization
Your build dey handle user sessions, data refresh, and state management well. But think if our current method really balance storage use with functionality.
Like chess players wey sabi pick important pieces and leave pawns, good state management go need to sabi which data must persist and which data better to always fresh from server.
**Optimization Analysis:**
Check your localStorage now and ask yourself:
- Which minimum info wey suppose hold user authentication?
- Which data dey change often wey local cache no really help?
- How storage optimization fit make performance better without spoil user experience?
Dis kind architectural thinking dey separate senior devs wey dey consider functionality and efficiency well.
**Implementation Strategy:**
- **Find** essential data wey must persist (usually just user id)
- **Change** localStorage to store only important session data
- **Make sure** fresh data fetch from server anytime dashboard open
- **Test** say your optimized method still give good user experience
**Advanced Consideration:**
- **Compare** storing full account data vs. only auth tokens
- **Write down** your choices and reasons for others later
Dis challenge go train you to think like professional dev wey sabi balance user experience and app efficiency. Take your time try different ways!
## Post-Lecture Quiz
[Post-lecture quiz](https://ff-quizzes.netlify.app/web/quiz/48)
## Assignment
[Implement "Add transaction" dialog](assignment.md)
Here na example result after you finish the assignment:
![Screenshot showing an example "Add transaction" dialog](../../../../translated_images/dialog.93bba104afeb79f1.pcm.png)
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document na toktok wey AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator) help do. Even though we try make am correct, abeg sabi say automatic translation fit get some mistakes or error. Di original document wey dem write for im own language na di real correct one. If na serious matter, make person wey sabi do translation well do am. We no go fit carry any gbege or wahala if pesin no understand well or get wrong meaning from dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,164 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "50a7783473b39a2e0f133e271a102231",
"translation_date": "2026-01-08T17:52:51+00:00",
"source_file": "7-bank-project/4-state-management/assignment.md",
"language_code": "pcm"
}
-->
# Implement "Add Transaction" Dialog
## Overview
Your banking app don get solid state management and data persistence, but e miss one important feature wey real banking apps need: make users fit add dia own transactions. For this assignment, you go implement complete "Add Transaction" dialog wey go connect well with your current state management system.
Dis assignment combine all wetin you don learn for the four banking lessons: HTML templating, form handling, API integration, and state management.
## Learning Objectives
When you finish dis assignment, you go fit:
- **Create** user-friendly dialog interface for data entry
- **Implement** accessible form design wey support keyboard and screen reader
- **Integrate** new features with your existing state management system
- **Practice** API communication and how to handle errors
- **Apply** modern web development patterns for real-world feature
## Instructions
### Step 1: Add Transaction Button
**Create** "Add Transaction" button for your dashboard page wey users fit find and use easily.
**Requirements:**
- **Place** the button for correct place for dashboard
- **Use** clear action dey for the button text
- **Style** the button to match your current UI design
- **Ensure** the button dey accessible with keyboard
### Step 2: Dialog Implementation
Choose one of these two ways to implement your dialog:
**Option A: Separate Page**
- **Create** new HTML template for the transaction form
- **Add** new route to your routing system
- **Implement** navigation to and from the form page
**Option B: Modal Dialog (Recommended)**
- **Use** JavaScript to show/hide the dialog without comot for the dashboard
- **Implement** using the [`hidden` property](https://developer.mozilla.org/docs/Web/HTML/Global_attributes/hidden) or CSS classes
- **Create** smooth user experience with proper focus management
### Step 3: Accessibility Implementation
**Ensure** say your dialog meet [accessibility standards for modal dialogs](https://developer.paciellogroup.com/blog/2018/06/the-current-state-of-modal-dialog-accessibility/):
**Keyboard Navigation:**
- **Support** Escape key to close the dialog
- **Trap** focus inside the dialog when e open
- **Return** focus to the trigger button when e close
**Screen Reader Support:**
- **Add** correct ARIA labels and roles
- **Announce** dialog open/close to screen readers
- **Provide** clear labels for form fields and error messages
### Step 4: Form Creation
**Design** HTML form wey go collect transaction data:
**Required Fields:**
- **Date**: When transaction happen
- **Description**: Wetin transaction be for
- **Amount**: Transaction value (positive for income, negative for expenses)
**Form Features:**
- **Validate** user input before you submit am
- **Provide** clear error messages for invalid data
- **Include** helpful placeholder text and labels
- **Style** am same way as your current design
### Step 5: API Integration
**Connect** your form to backend API:
**Implementation Steps:**
- **Review** the [server API specifications](../api/README.md) for correct endpoint and data format
- **Create** JSON data from your form inputs
- **Send** the data to the API with correct error handling
- **Display** success or failure messages to the user
- **Handle** network errors well
### Step 6: State Management Integration
**Update** your dashboard with the new transaction:
**Integration Requirements:**
- **Refresh** the account data after transaction add finish well
- **Update** dashboard display without needing page reload
- **Ensure** the new transaction show immediately
- **Maintain** correct state consistency during the whole process
## Technical Specifications
**API Endpoint Details:**
Refer to the [server API documentation](../api/README.md) for:
- Required JSON format for transaction data
- HTTP method and endpoint URL
- Expected response format
- Error response handling
**Expected Result:**
After you finish this assignment, your banking app suppose get fully working "Add Transaction" feature wey look and behave professionally:
![Screenshot showing an example "Add transaction" dialog](../../../../translated_images/dialog.93bba104afeb79f1.pcm.png)
## Testing Your Implementation
**Functional Testing:**
1. **Verify** "Add Transaction" button dey clearly visible and accessible
2. **Test** say the dialog open and close properly
3. **Confirm** form validation dey work for all required fields
4. **Check** say successful transactions show immediately for dashboard
5. **Ensure** error handling dey work for invalid data and network wahala
**Accessibility Testing:**
1. **Navigate** through the whole flow with keyboard only
2. **Test** with screen reader to confirm correct announcements
3. **Verify** focus management dey work well
4. **Check** say all form elements get correct labels
## Evaluation Rubric
| Criteria | Exemplary | Adequate | Needs Improvement |
| -------- | --------- | -------- | ----------------- |
| **Functionality** | Add transaction feature dey work perfectly with excellent user experience and follow all best practices from lessons | Add transaction feature dey work correctly but fit no follow some best practices or get small usability wahala | Add transaction feature dey partly work or get serious usability problems |
| **Code Quality** | Code well-organized, follow correct patterns, get proper error handling, and integrate well with existing state management | Code dey work but maybe dey disorganized or no consistent with existing codebase patterns | Code get big structural issues or no integrate well with existing patterns |
| **Accessibility** | Full keyboard navigation support, screen reader compatible, and follow WCAG guidelines with excellent focus management | Basic accessibility features dey but some keyboard navigation or screen reader features fit dey missing | Limited or no accessibility considerations implement |
| **User Experience** | Intuitive, polished interface with clear feedback, smooth interactions, and professional look | Good user experience with small room to improve feedback or visual design | Poor user experience with confusing interface or no user feedback |
## Additional Challenges (Optional)
Once you don finish the basic requirements, consider these enhancements:
**Enhanced Features:**
- **Add** transaction categories (food, transportation, entertainment, etc.)
- **Implement** input validation with real-time feedback
- **Create** keyboard shortcuts for power users
- **Add** transaction editing and deletion abilities
**Advanced Integration:**
- **Implement** undo function for recently added transactions
- **Add** bulk transaction import from CSV files
- **Create** transaction search and filtering abilities
- **Implement** data export function
These optional features go help you practice more advanced web development ideas and build more complete banking app!
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document don translate with AI translation service wey dem dey call [Co-op Translator](https://github.com/Azure/co-op-translator). Even though we dey try make am correct, abeg sabi say automated translation fit get some mistakes or no too correct. The original document wey dem write for im own language na im get proper authority. If na serious matter, e better make human professional translate am. We no go responsible if person misunderstand or arrange the meaning wrong because of this translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,37 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "830359535306594b448db6575ce5cdee",
"translation_date": "2026-01-08T11:29:58+00:00",
"source_file": "7-bank-project/README.md",
"language_code": "pcm"
}
-->
# :dollar: Build Bank
For dis project, you go learn how to build one fictional bank. Dem lessons go show you how to layout web app and provide routes, build forms, manage state, plus how to fetch data from API wey you fit use take get di bank data.
| ![Screen1](../../../translated_images/screen1.baccbba0f1f93364.pcm.png) | ![Screen2](../../../translated_images/screen2.123c82a831a1d14a.pcm.png) |
|--------------------------------|--------------------------------|
## Lessons
1. [HTML Templates and Routes in a Web App](1-template-route/README.md)
2. [Build Login and Registration Form](2-forms/README.md)
3. [Methods for Fetching and Using Data](3-data/README.md)
4. [Concepts for State Management](4-state-management/README.md)
### Credits
Dem lessons na wetin :hearts: [Yohan Lasorsa](https://twitter.com/sinedied) write.
If you wan learn how to build di [server API](/7-bank-project/api/README.md) wey dem use for dis lessons, you fit follow [dis series of videos](https://aka.ms/NodeBeginner) (specially video 17 to 21).
You fit also check [dis interactive Learn tutorial](https://aka.ms/learn/express-api).
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document na AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator) translate am. Though we dey try make am correct, abeg sabi say automatic translations fit get mistake or no too clear. The original document wey dey im own language na di correct one. If na serious matter, e better make professional human translator check am. We no go take any blame if pesin no understand or miss-interpret because of dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,50 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "9884f8c8a61cf56214450f8b16a094ce",
"translation_date": "2026-01-08T16:38:52+00:00",
"source_file": "7-bank-project/api/README.md",
"language_code": "pcm"
}
-->
# Bank API
> Bank API wey dem build with [Node.js](https://nodejs.org) + [Express](https://expressjs.com/).
The API don already don build for you and no be part of the exercise.
But if you want learn how to build API like dis one, you fit follow dis kind video series: https://aka.ms/NodeBeginner (videos 17 reach 21 na dem cover dis exact API).
You fit also check dis interactive tutorial: https://aka.ms/learn/express-api
## Running the server
Make sure say you get [Node.js](https://nodejs.org) installed.
1. Git clone dis repo [The Web-Dev-For-Beginners](https://github.com/microsoft/Web-Dev-For-Beginners).
2. Open your terminal come waka inside `Web-Dev-For-Beginners/7-bank-project/api` folder
2. Run `npm install` come wait make packages install finish (e fit take small time depend on your internet speed).
3. After installation finish, run `npm start` come you ready.
The server suppose start dey listen for port `5000`.
*Dis server go dey run together wit di main bank app server terminal (wey dey for port `3000`), no close am.*
> Note: all di data dey saved na for memory, no dey permanent, so once server stop all data go lost.
## API details
Route | Description
---------------------------------------------|------------------------------------
GET /api/ | Collect info about di server
POST /api/accounts/ | Create account, ex: `{ user: 'Yohan', description: 'My budget', currency: 'EUR', balance: 100 }`
GET /api/accounts/:user | Collect all info for di specified account
DELETE /api/accounts/:user | Delete di specified account
POST /api/accounts/:user/transactions | Add transaction, ex: `{ date: '2020-07-23T18:25:43.511Z', object: 'Bought a book', amount: -20 }`
DELETE /api/accounts/:user/transactions/:id | Delete di specified transaction
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis dokument don translate wit AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator). Even though we try make am correct, make you sabi say automated translation fit get mistakes or no too clear. Di original dokument for im own language na di real correct one. If na important information, e better make professional human translator do am. We no go responsible for any wahala or wrong understanding wey fit show because of dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,28 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "461aa4fc74c6b1789c3a13b5d82c0cd9",
"translation_date": "2026-01-08T18:06:31+00:00",
"source_file": "7-bank-project/solution/README.md",
"language_code": "pcm"
}
-->
# Bank app
> Example solution for the bank app project, built with vanilla HTML5, CSS and JavaScript (no frameworks or libraries used).
## Running the app
First make sure say you get the [API server](../api/README.md) wey dey run.
Any web server fit run the app, but as you suppose get [Node.js](https://nodejs.org) install anyhow to run the API, you fit:
1. Git clone this repo.
2. Open terminal, waka enter this directory, then run `npx lite-server .`. E go start one development web server for port `3000`
3. Open `http://localhost:3000` for browser to run the app.
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**: Dis document don translate wit AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator). Even tho we dey try make am correct, abeg no forget say automated translations fit get mistakes or no too clear. Di original document wey e dey for im own language na di correct one. If na serious mata, better make human professional translate am. We no go take responsibility for any wahala or wrong understanding wey fit happen because of dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,639 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "a9a3bcc037a447e2d8994d99e871cd9f",
"translation_date": "2026-01-08T13:11:41+00:00",
"source_file": "8-code-editor/1-using-a-code-editor/README.md",
"language_code": "pcm"
}
-->
# Using a Code Editor: Mastering VSCode.dev
Remember for *The Matrix* when Neo bin haff plug inside one big computer terminal to waka enter di digital world? Today web development tools na di oda side plenty power full skill wey anybody fit use from anywhere. VSCode.dev na browser-based code editor wey dey carry professional development tools go any device wey get internet connection.
Just like how di printing press make books easy for everybody to read, no be only scribes for monastery, VSCode.dev dey give everybody chance to do code. You fit work on projects from library computer, school lab, or anywhere wey you get browser access. No need to install anything, no need to talk say "I need my own setup."
By di end of dis lesson, you go sabi how to waka for VSCode.dev, open GitHub repositories direct for your browser, and use Git for version control all na di skills professional developers dey use every day.
## ⚡ Wetin You Fit Do for Di Next 5 Minutes
**Quick Start Pathway for Busy Developers**
```mermaid
flowchart LR
A[⚡ 5 minutes] --> B[Go vscode.dev]
B --> C[Join GitHub account]
C --> D[Open any repository]
D --> E[Start to edit sharp sharp]
```
- **Minute 1**: Go [vscode.dev](https://vscode.dev) no need to install anything
- **Minute 2**: Sign in with GitHub to connect your repositories
- **Minute 3**: Try di URL trick: change `github.com` to `vscode.dev/github` for any repo URL
- **Minute 4**: Create new file and watch as syntax highlighting just dey work by itself
- **Minute 5**: Make change and commit am through the Source Control panel
**Quick Test URL**:
```
# Transform this:
github.com/microsoft/Web-Dev-For-Beginners
# Into this:
vscode.dev/github/microsoft/Web-Dev-For-Beginners
```
**Why Dis Matter**: For 5 minutes, you go feel di freedom of coding anywhere with professional tools. Dis na di future of development easy to get, powerful, and fast.
## 🗺️ Your Learning Journey Through Cloud-Based Development
```mermaid
journey
title From Local Setup to Cloud Development Mastery
section Understanding the Platform
Discover web-based editing: 4: You
Connect to GitHub ecosystem: 6: You
Master interface navigation: 7: You
section File Management Skills
Create and organize files: 5: You
Edit with syntax highlighting: 7: You
Navigate project structures: 8: You
section Version Control Mastery
Understand Git integration: 6: You
Practice commit workflows: 8: You
Master collaboration patterns: 9: You
section Professional Customization
Install powerful extensions: 7: You
Configure development environment: 8: You
Build personal workflows: 9: You
```
**Your Journey Destination**: By di end of dis lesson, you go don master professional cloud development environment wey dey work from any device, make you dey code with same tools developers dey use for big tech companies.
## Wetin You Go Learn
After we waka together, you go fit:
- Waka for VSCode.dev like na your own second home find everything without confusion
- Open any GitHub repository for your browser and start to edit immediately (dis one na correct magic!)
- Use Git to track your changes and save your work like pro
- Boost your editor with extensions wey go make coding faster and more fun
- Create and organize project files with confidence
## Wetin You Go Need
Di requirements simple:
- Free [GitHub account](https://github.com) (we go show you how to create if you need help)
- Basic sabi how web browsers dey work
- The GitHub Basics lesson get useful background, although e no too necessary
> 💡 **You be New GitHub User?** Creating account na free and e go take only few minutes. Like how library card dey give you access to books globally, GitHub account go open doors to plenty code repositories for internet.
## 🧠 Cloud Development Ecosystem Overview
```mermaid
mindmap
root((VSCode.dev Mastery))
Platform Benefits
Accessibility
Device Independence
No Installation Required
Instant Updates
Universal Access
Integration
GitHub Connection
Repository Sync
Settings Persistence
Collaboration Ready
Development Workflow
File Management
Project Structure
Syntax Highlighting
Multi-tab Editing
Auto-save Features
Version Control
Git Integration
Commit Workflows
Branch Management
Change Tracking
Customization Power
Extensions Ecosystem
Productivity Tools
Language Support
Theme Options
Custom Shortcuts
Environment Setup
Personal Preferences
Workspace Configuration
Tool Integration
Workflow Optimization
Professional Skills
Industry Standards
Version Control
Code Quality
Collaboration
Documentation
Career Readiness
Remote Work
Cloud Development
Team Projects
Open Source
```
**Core Principle**: Cloud-based development environments na di future of coding dem dey provide professional-level tools wey everybody fit use, collaborate, and no worry which platform you dey use.
## Why Web-Based Code Editors Get Importance
Before internet, scientists for different universities no fit easily share their research. Then ARPANET come for 1960s, e connect computers together across long distance. Web-based code editors follow the same idea dey make powerful tools fit any place or any device you dey use.
Code editor na your work area where you write, edit, and organize code files. E no be like simple text editors; professional code editors dey give you syntax highlighting, error detection, and project management.
VSCode.dev dey bring all these power to your browser:
**Web-based editing advantages:**
| Feature | Description | Practical Benefit |
|---------|-------------|-------------------|
| **Platform Independence** | E dey run on any device with browser | You fit work for many computers easily |
| **No Installation Required** | You fit access with web URL | No need install software for your device |
| **Automatic Updates** | E dey always run di latest version | You dey get new features without stress |
| **Repository Integration** | Direct connection to GitHub | You fit edit code without managing local files |
**Practical implications:**
- Work fit continue anywhere same same
- Interface consistent for any operating system
- Collaboration fit happen quickly
- Local storage no go full too fast
## Exploring VSCode.dev
Just like how Marie Curie laboratory get plenty advanced equipment inside one small space, VSCode.dev put professional development tools inside your browser interface. Dis web app dey do the same things desktop editors do.
Start by going to [vscode.dev](https://vscode.dev) inside your browser. Interface go load quick without any installation or download na real cloud computing principles.
### Connecting Your GitHub Account
Like Alexander Graham Bell telephone connect far places, connecting your GitHub account join VSCode.dev with your code repos. When dem ask you sign in with GitHub, e good to accept.
**GitHub integration gives you:**
- Direct access to your repositories inside the editor
- Settings and extensions synchronize across devices
- Easy saving flow to GitHub
- Personalized development environment
### Getting to Know Your New Workspace
Once e don load finish, you go see clean workspace wey design to help you focus on wetin important your code!
![Default VSCode.dev interface](../../../../translated_images/default-vscode-dev.5d06881d65c1b323.pcm.png)
**Here na your neighborhood tour:**
- **Activity Bar** (di left strip): Na your main navigation, get Explorer 📁, Search 🔍, Source Control 🌿, Extensions 🧩, and Settings ⚙️
- **Sidebar** (panel wey dey beside am): E dey change to show relevant info based on wetin you select
- **Editor Area** (big space for middle): Na dia di magic dey happen your main coding space
**Take small time explore:**
- Click those Activity Bar icons, see wetin each one dey do
- Notice how sidebar dey change to show different info e cool well well
- Explorer view (📁) na where you go spend most time, make you get familiar with am
```mermaid
flowchart TB
subgraph "VSCode.dev Interface Architecture"
A[Activity Bar] --> B[Explorer 📁]
A --> C[Search 🔍]
A --> D[Source Control 🌿]
A --> E[Extensions 🧩]
A --> F[Settings ⚙️]
B --> G[File Tree]
C --> H[Find & Replace]
D --> I[Git Status]
E --> J[Extension Marketplace]
F --> K[Configuration]
L[Sidebar] --> M[Context Panel]
N[Editor Area] --> O[Code Files]
P[Terminal/Output] --> Q[Command Line]
end
```
## Opening GitHub Repositories
Before internet, researchers haff waka go libraries to find documents. GitHub repositories na similar thing collections of code stored for remote places. VSCode.dev remove di need to download repositories before you fit edit.
Dis go give you immediate access to any public repository to see, edit, or contribute. Here be two ways to open repositories:
### Method 1: The Point-and-Click Way
Dis one good when you dey start new inside VSCode.dev and you wan open one specific repo. E easy and good for beginners:
**How to do am:**
1. Go [vscode.dev](https://vscode.dev) if you never enter
2. Find "Open Remote Repository" button for welcome screen, click am
![Open remote repository](../../../../translated_images/open-remote-repository.bd9c2598b8949e7f.pcm.png)
3. Paste any GitHub repo URL (try dis one: `https://github.com/microsoft/Web-Dev-For-Beginners`)
4. Press Enter, make magic happen!
**Pro tip - The Command Palette shortcut:**
Wanna feel like coding wizard? Try keyboard shortcut: Ctrl+Shift+P (or Cmd+Shift+P for Mac) to open Command Palette:
![Command Palette](../../../../translated_images/palette-menu.4946174e07f42622.pcm.png)
**Command Palette na like search engine for everything you fit do:**
- Type "open remote" and e go find the repository opener for you
- E dey remember repositories wey you open before (e dey useful!)
- When you sabi am, you go code like fast lightning
- E be like VSCode.dev own "Hey Siri, but for coding"
### Method 2: URL Modification Technique
Like how HTTP and HTTPS dey use different protocols but keep same domain, VSCode.dev get URL pattern wey mirror GitHub addressing. Any GitHub repo URL fit change to open direct for VSCode.dev.
**URL transformation pattern:**
| Repository Type | GitHub URL | VSCode.dev URL |
|----------------|---------------------|----------------|
| **Public Repository** | `github.com/microsoft/Web-Dev-For-Beginners` | `vscode.dev/github/microsoft/Web-Dev-For-Beginners` |
| **Personal Project** | `github.com/your-username/my-project` | `vscode.dev/github/your-username/my-project` |
| **Any Accessible Repo** | `github.com/their-username/awesome-repo` | `vscode.dev/github/their-username/awesome-repo` |
**How e dey work:**
- Change `github.com` to `vscode.dev/github`
- Keep all other parts of URL same
- E work with any public repository
- You go fit start edit quick
> 💡 **Life-changing tip**: Bookmark your favorite VSCode.dev repo URLs. I get bookmarks like "Edit My Portfolio" and "Fix Documentation" wey dey carry me enter edit mode direct!
**Which way you go use?**
- **Interface way**: Good when you dey explore or you no remember exact repo name
- **URL trick**: Perfect for fast access when you know exactly where you dey go
### 🎯 Pedagogical Check-in: Cloud Development Access
**Pause and Reflect**: You just learn two ways to access code repos through browser. E mean say big change don happen for how development dey work.
**Quick Self-Assessment**:
- Fit explain why web-based editing no need traditional "environment setup"?
- Wetin URL modification trick get better pass local git cloning?
- How dis style fit change how you go contribute to open source projects?
**Real-World Connection**: Big companies like GitHub, GitLab, and Replit build their platforms with cloud-first mindset. You dey learn same workflows professional developer teams dey use worldwide.
**Challenge Question**: How cloud-based development fit change how coding dey taught for school? Think about device needs, software management, and collaboration possibilities.
## Working with Files and Projects
Now wey you don open repository, make we start to build! VSCode.dev give you everything you need to create, edit, and organize code files. E be like your own digital workshop all tools dey where you need am.
Make we enter everyday tasks wey go make your coding workflow easy.
### Creating New Files
Like how architect organize blueprints for office, file creation for VSCode.dev dey follow structured process. System support all standard web dev file types.
**File creation steps:**
1. Go target folder on Explorer sidebar
2. Hover over folder name to see "New File" icon (📄+)
3. Type filename with correct extension (`style.css`, `script.js`, `index.html`)
4. Press Enter to create am
![Creating a new file](../../../../translated_images/create-new-file.2814e609c2af9aeb.pcm.png)
**Name rules:**
- Use descriptive names wey show file purpose
- Put file extensions for correct syntax highlighting
- Follow consistent naming style for projects
- Use lowercase letters and hyphens instead of spaces
### Editing and Saving Files
Now di real fun don start! VSCode.dev editor get plenty helper features wey dey make coding smooth and easy. E be like smart writing assistant, but for code.
**Your editing workflow:**
1. Click any file for Explorer to open am inside main area
2. Start to type and watch VSCode.dev help you with colors, suggestions, and error alerts
3. Save with Ctrl+S (Windows/Linux) or Cmd+S (Mac) but e also auto-saves
![Editing files in VSCode.dev](../../../../translated_images/edit-a-file.52c0ee665ef19f08.pcm.png)
**The cool things wey dey happen as you code:**
- Your code dey color-coded well so e easy to read
- VSCode.dev dey suggest completions as you type (like autocorrect, but smarter)
- E dey catch typos and errors before you save
- You fit open many files with tabs, just like browser
- Everything dey save automatically for background
> ⚠️ **Quick tip**: Even though auto-save dey work, better make you hit Ctrl+S or Cmd+S sometimes. E go save everything quick and trigger extra features like error checking.
### Version Control with Git
Like how archaeologists dey keep detailed record of their excavation layers, Git dey track changes for your code over time. This system keep project history and allow you to go back to older versions. VSCode.dev get built-in Git support.
**Source Control interface:**
1. Go Source Control panel by clicking 🌿 icon for Activity Bar
2. Files wey you change go show for "Changes" section
3. Colors show type of changes: green for additions, red for deletions
![Viewing changes in Source Control](../../../../translated_images/working-tree.c58eec08e6335c79.pcm.png)
**How to save your work (commit process):**
```mermaid
flowchart TD
A[Make changes to files] --> B[View changes for Source Control]
B --> C[Stage changes by clicking +]
C --> D[Write descriptive commit message]
D --> E[Click checkmark to commit]
E --> F[Changes push go GitHub]
```
```mermaid
stateDiagram-v2
[*] --> Modified: Edit files
Modified --> Staged: Click + to stage
Staged --> Modified: Click - to unstage
Staged --> Committed: Add message & commit
Committed --> [*]: Sync to GitHub
state Committed {
[*] --> LocalCommit
LocalCommit --> RemotePush: Auto-sync
}
```
**Step-by-step:**
- Click "+" icon beside files you want to save (dis dey "stage" them)
- Double-check say you dey happy wit all di changes wey you don stage
- Write small note wey explain wetin you do (dis na your "commit message")
- Click di checkmark button to save everytin to GitHub
- If you change mind about sometin, di undo icon go let you discard changes
**How to write beta commit messages (dis one no hard like you tink!):**
- Just talk wetin you do, like "Add contact form" or "Fix broken navigation"
- Make am short and sweet think tweet length, no long essay
- Start wit action words like "Add", "Fix", "Update", or "Remove"
- **Good examples**: "Add responsive navigation menu", "Fix mobile layout issues", "Update colors for better accessibility"
> 💡 **Quick navigation tip**: Use di hamburger menu (☰) for top left to jump back to your GitHub repository and see di changes wey you don commit online. E be like portal wey connect your editing environment and your project home for GitHub!
## Enhancing Functionality with Extensions
Just like how craftsperson workshop get special tools for different work, VSCode.dev fit customize wit extensions wey add extra abilities. Dis community-made plugins dey solve common development needs like code formatting, live preview, and better Git integration.
Di extension marketplace get thousands free tools wey developers worldwide create. Each extension dey solve particular workflow wahala, so you fit build your own personalized development environment wey fit your own needs and taste.
```mermaid
mindmap
root((Extension Ecosystem))
Essential Categories
Productivity
Live Server
Auto Rename Tag
Bracket Pair Colorizer
GitLens
Code Quality
Prettier
ESLint
Spell Checker
Error Lens
Language Support
HTML CSS Support
JavaScript ES6
Python Extension
Markdown Preview
Themes & UI
Dark+ Modern
Material Icon Theme
Peacock
Rainbow Brackets
Discovery Methods
Popular Rankings
Download Counts
User Ratings
Recent Updates
Community Reviews
Recommendations
Workspace Suggestions
Language-based
Workflow-specific
Team Standards
```
### Finding Your Perfect Extensions
Di extension marketplace organize well well, so you no go lost trying find wetin you need. E design to help you discover specific tools and even beta tins wey you no sabi say dey!
**How to reach di marketplace:**
1. Click di Extensions icon (🧩) for di Activity Bar
2. Browse around or search for wetin you want
3. Click on anything wey look interesting to learn more about am
![Extension marketplace interface](../../../../translated_images/extensions.eca0e0c7f59a10b5.pcm.png)
**Wetin you go see inside:**
| Section | Wetin Dey Inside | Why E Dey Helpful |
|----------|---------|----------|
| **Installed** | Extensions wey you don add before | Your personal coding toolkit |
| **Popular** | Di crowd favourites | Wetin most developers trust well well |
| **Recommended** | Smart suggestions for your project | VSCode.dev beta recommendations |
**Wetin make browsing easy:**
- Each extension show ratings, download count, and real user reviews
- You go get screenshots and clear explanations of wetin each one dey do
- Everything mark well with compatibility info
- Similar extensions dey suggest so you fit compare options
### Installing Extensions (E Easy Pass Jollof!)
Adding new power to your editor easy like clicking button. Extensions install quick quick and start work immediately no restart, no wait.
**Wet you need do na:**
1. Search for wetin you want (try search "live server" or "prettier")
2. Click one wey look good to see more detail
3. Read what e dey do and check di ratings
4. Press di blue "Install" button and you done!
![Installing extensions](../../../../8-code-editor/images/install-extension.gif)
**Wetin dey happen behind di scene:**
- Di extension go download and set up automatically
- New features go show for your interface immediately
- Everything go start work like lightning (serious!)
- If you sign in, di extension go sync to all your devices
**Some extensions wey I suggest for start:**
- **Live Server**: See your website update live as you dey code (dis one na magic!)
- **Prettier**: Make your code clean and professional automatically
- **Auto Rename Tag**: Change one HTML tag, its partner go change too
- **Bracket Pair Colorizer**: Color your brackets so you no go lost
- **GitLens**: Boost your Git features with plenty useful info
### Customizing Your Extensions
Most extensions get settings wey you fit adjust make dem work exactly how you want. Think am like how you adjust seat and mirrors for car everybody get e own preference!
**How to adjust extension settings:**
1. Find your installed extension for di Extensions panel
2. Find di small gear icon (⚙️) next to the name and click am
3. Choose "Extension Settings" from di dropdown
4. Change tins till e feel right for your workflow
![Customizing extension settings](../../../../translated_images/extension-settings.21c752ae4f4cdb78.pcm.png)
**Common tins wey you fit want change:**
- How your code go be formatted (tabs or spaces, line length, etc.)
- Which keyboard shortcuts go trigger certain actions
- Which file types di extension suppose work with
- Turn some features on or off to keep everytin clean
### Keeping Your Extensions Organized
As you discover beta extensions, you go want keep your collection tidy and correct. VSCode.dev make dis very easy to manage.
**Your extension management options:**
| Wetin You Fit Do | When E Dey Helpful | Pro Tip |
|--------|---------|----------|
| **Disable** | Test if extension dey cause wahala | Better than uninstall if you fit want am back |
| **Uninstall** | Remove extension wey you no want again | Keep your environment clean and fast |
| **Update** | Get latest features and bug fixes | Usually automatic, but good to check |
**How I like manage extensions:**
- Every few months, I go check wetin I don install and remove tins wey I no dey use
- I dey keep extensions updated to get latest improvements and security fixes
- If somtin dey slow, I go temporarily disable extensions to find which one be culprit
- I dey read update notes when extensions get big updates sometimes new cool features dey!
> ⚠️ **Performance tip**: Extensions good, but if too many, e fit slow tin down. Focus on ones wey really make your life easier and no fear to uninstall ones you no dey use.
### 🎯 Pedagogical Check-in: Development Environment Customization
**Architecture Understanding**: You don learn how to customize professional development environment using community-made extensions. E resemble how big enterprise teams build standardized toolchains.
**Key Concepts Mastered**:
- **Extension Discovery**: Find tools wey solve specific development challenges
- **Environment Configuration**: Customize tools to match personal or team taste
- **Performance Optimization**: Balance functionality with system performance
- **Community Collaboration**: Use tools created by global developer community
**Industry Connection**: Extension ecosystems power big development platforms like VS Code, Chrome DevTools, and modern IDEs. To sabi how to check, install, and configure extensions na key for professional development workflow.
**Reflection Question**: How you go take set up a standardized development environment for team of 10 developers? Think about consistency, performance, and individual preferences.
## 📈 Your Cloud Development Mastery Timeline
```mermaid
timeline
title Professional Cloud Development Journey
section Platform Foundations
Cloud Development Understanding
: Master web-based editing concepts
: Connect GitHub integration patterns
: Navigate professional interfaces
section Workflow Mastery
File & Project Management
: Create organized project structures
: Master syntax highlighting benefits
: Handle multi-file editing workflows
Version Control Integration
: Understand Git visualization
: Practice commit message standards
: Master change tracking workflows
section Environment Customization
Extension Ecosystem
: Discover productivity extensions
: Configure development preferences
: Optimize performance vs functionality
Professional Setup
: Build consistent workflows
: Create reusable configurations
: Establish team standards
section Industry Readiness
Cloud-First Development
: Master remote development practices
: Understand collaborative workflows
: Build platform-independent skills
Professional Practices
: Follow industry standards
: Create maintainable workflows
: Prepare for team environments
```
**🎓 Graduation Milestone**: You don master cloud-based development using same tools and workflows wey professional developers dey use for big tech companies. These skills be future of software development.
**🔄 Next Level Capabilities**:
- Ready to explore advanced cloud development platforms (Codespaces, GitPod)
- Fit work for distributed development teams
- Ready to contribute to open source projects worldwide
- Foundation set for modern DevOps and continuous integration practices
## GitHub Copilot Agent Challenge 🚀
Like NASA style approach for space mission, dis challenge na systematic use of VSCode.dev skills in complete workflow.
**Objective:** Show say you sabi use VSCode.dev by building complete web development workflow.
**Project requirements:** Using Agent mode help, complete dis tasks:
1. Fork existing repository or create new one
2. Set up functional project structure wit HTML, CSS, and JavaScript files
3. Install and configure three development-enhancing extensions
4. Practice version control wit descriptive commit messages
5. Try feature branch creation and modification
6. Document wetin you do and wetin you learn for README.md
Dis exercise join all VSCode.dev concepts for one real-world workflow wey you fit use for future projects.
Learn more about [agent mode](https://code.visualstudio.com/blogs/2025/02/24/introducing-copilot-agent-mode) here.
## Assignment
Time to test these skills for real! I get hands-on project wey go let you practice everything we don cover: [Create a resume website using VSCode.dev](./assignment.md)
Dis assignment go guide you build professional resume website completely for your browser. You go use all VSCode.dev features wey we talk about, by di end you go get beta website plus solid confidence for your new workflow.
## Keep Exploring and Growing Your Skills
You don get strong foundation now, but still plenty beta tins to discover! Here dey some resources and ideas to grow your VSCode.dev skills to next level:
**Official docs wey worth bookmarking:**
- [VSCode Web Documentation](https://code.visualstudio.com/docs/editor/vscode-web?WT.mc_id=academic-0000-alfredodeza) Complete guide to browser-based editing
- [GitHub Codespaces](https://docs.github.com/en/codespaces) For when you want even more power for cloud
**Cool features to try next:**
- **Keyboard Shortcuts**: Learn key combos wey go make you feel like coding ninja
- **Workspace Settings**: Set up different environments for different project types
- **Multi-root Workspaces**: Work on multiple repositories at same time (super useful!)
- **Terminal Integration**: Access command-line tools directly inside browser
**Ideas for practice:**
- Jump into open-source projects and contribute using VSCode.dev na beta way to give back!
- Try different extensions to find your perfect setup
- Create project templates for sites you build most
- Practice Git workflows like branching and merging these skills be gold for team projects
---
**You don master browser-based development!** 🎉 Like how portable instruments allow scientists to do research anywhere, VSCode.dev enable professional coding from any device wey get internet.
These skills show correct industry practice many professional developers use cloud-based environments for flexibility and easy access. You don learn workflow wey fit range from individual projects to big team collaboration.
Use these skills for your next development project! 🚀
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document dem don translate am wit AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator). Even tho we try make am correct, abeg sabi say automatic translation fit get some mistake or no too clear. Di original document wey dey for e own language na di correct one. If na serious matter, e better make human person wey sabi translate do am. We no dey responsible for any wrong understanding or wrong meaning wey fit happen because of dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,591 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "effe56ba51c38d7bdfad1ea38288666b",
"translation_date": "2026-01-08T13:20:50+00:00",
"source_file": "8-code-editor/1-using-a-code-editor/assignment.md",
"language_code": "pcm"
}
-->
# Create a Resume Website Using VSCode.dev
Transform your career prospects by building a professional resume website wey dey show your skills and experience for interactive, modern format. Instead make you dey send traditional PDFs, think say you fit give recruiters one clean, responsive website wey dey show both your qualifications and your web development skills.
This hands-on assignment go make all your VSCode.dev skills work as you dey create something wey go really help your career. You go experience the full web development workflow from repository creation to deployment all inside your browser.
If you complete this project, you go get professional online presence wey e easy to share with potential employers, fit update as your skills grow, and you fit customize am to match your personal brand. Na this kind practical project dey show real-world web development skills.
## Learning Objectives
After you finish this assignment, you go fit:
- **Create** and manage full web development project using VSCode.dev
- **Structure** professional website using semantic HTML elements
- **Style** responsive layouts with modern CSS techniques
- **Implement** interactive features using basic web technologies
- **Deploy** one live website wey people fit access with shareable URL
- **Demonstrate** version control best practices throughout the development process
## Prerequisites
Before you start this assignment, make sure say you get:
- GitHub account (if no get, create one for [github.com](https://github.com/))
- Finish the VSCode.dev lesson wey cover interface navigation and basic operations
- Basic understanding of HTML structure and CSS styling concepts
## Project Setup and Repository Creation
Make we start to set up your project foundation. This process dey similar to real-world development workflow wey projects dey start with proper repository initialization and structure planning.
### Step 1: Create Your GitHub Repository
To set up dedicated repository go make sure say your project dey well organize and version-controlled from the start.
1. **Go** to [GitHub.com](https://github.com) and sign in to your account
2. **Click** the green "New" button or the "+" icon for top-right corner
3. **Name** your repository `my-resume` (or choose another name wey be like `john-smith-resume`)
4. **Add** short description: "Professional resume website built with HTML and CSS"
5. **Choose** "Public" so that employers fit access your resume
6. **Check** "Add a README file" to create initial project description
7. **Click** "Create repository" to finish the setup
> 💡 **Repository Naming Tip**: Use descriptive, professional names wey clearly talk the project purpose. This one go help if you wan share am with employers or during portfolio reviews.
### Step 2: Initialize Project Structure
Because VSCode.dev need at least one file to open repository, we go create our main HTML file directly for GitHub before we switch go the web editor.
1. **Click** "creating a new file" link for your new repository
2. **Type** `index.html` as the filename
3. **Add** this initial HTML structure:
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Your Name - Professional Resume</title>
</head>
<body>
<h1>Your Name</h1>
<p>Professional Resume Website</p>
</body>
</html>
```
4. **Write** commit message: "Add initial HTML structure"
5. **Click** "Commit new file" to save your work
![Creating initial file on GitHub](../../../../translated_images/new-file-github.com.c886796d800e8056.pcm.png)
**Wetin this initial setup dey do:**
- **Establishes** correct HTML5 document structure with semantic elements
- **Includes** viewport meta tag for responsive design
- **Sets** descriptive page title wey go show for browser tab
- **Creates** foundation for professional content organization
## Working in VSCode.dev
Now we don set your repository foundation, make we move go VSCode.dev to do the main development work. This web-based editor get all tools wey you need for professional web development.
### Step 3: Open Your Project in VSCode.dev
1. **Go** to [vscode.dev](https://vscode.dev) for new browser tab
2. **Click** "Open Remote Repository" for welcome screen
3. **Copy** your repository URL from GitHub and paste am for input box
Format: `https://github.com/your-username/my-resume`
*Replace `your-username` with your real GitHub username*
4. **Press** Enter to load your project
**Success indicator**: You go see your project files for Explorer sidebar and `index.html` ready for editing for main editor
![Project loaded in VSCode.dev](../../../../translated_images/project-on-vscode.dev.e79815a9a95ee7fe.pcm.png)
**Wetin you go see for interface:**
- **Explorer sidebar**: **Shows** your repository files and folder structure
- **Editor area**: **Displays** content of selected files for editing
- **Activity bar**: **Gives** access to features like Source Control and Extensions
- **Status bar**: **Shows** connection status and current branch info
### Step 4: Build Your Resume Content
Replace the placeholder content inside `index.html` with full resume structure. This HTML go be the foundation for professional way to show your qualifications.
<details>
<summary><b>Complete HTML Resume Structure</b></summary>
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="style.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
<title>Your Name - Professional Resume</title>
</head>
<body>
<header id="header">
<h1>Your Full Name</h1>
<hr>
<p class="role">Your Professional Title</p>
<hr>
</header>
<main>
<article id="mainLeft">
<section>
<h2>CONTACT</h2>
<p>
<i class="fa fa-envelope" aria-hidden="true"></i>
<a href="mailto:your.email@domain.com">your.email@domain.com</a>
</p>
<p>
<i class="fab fa-github" aria-hidden="true"></i>
<a href="https://github.com/your-username">github.com/your-username</a>
</p>
<p>
<i class="fab fa-linkedin" aria-hidden="true"></i>
<a href="https://linkedin.com/in/your-profile">linkedin.com/in/your-profile</a>
</p>
</section>
<section>
<h2>SKILLS</h2>
<ul>
<li>HTML5 & CSS3</li>
<li>JavaScript (ES6+)</li>
<li>Responsive Web Design</li>
<li>Version Control (Git)</li>
<li>Problem Solving</li>
</ul>
</section>
<section>
<h2>EDUCATION</h2>
<h3>Your Degree or Certification</h3>
<p>Institution Name</p>
<p>Start Date - End Date</p>
</section>
</article>
<article id="mainRight">
<section>
<h2>ABOUT</h2>
<p>Write a compelling summary that highlights your passion for web development, key achievements, and career goals. This section should give employers insight into your personality and professional approach.</p>
</section>
<section>
<h2>WORK EXPERIENCE</h2>
<div class="job">
<h3>Job Title</h3>
<p class="company">Company Name | Start Date End Date</p>
<ul>
<li>Describe a key accomplishment or responsibility</li>
<li>Highlight specific skills or technologies used</li>
<li>Quantify impact where possible (e.g., "Improved efficiency by 25%")</li>
</ul>
</div>
<div class="job">
<h3>Previous Job Title</h3>
<p class="company">Previous Company | Start Date End Date</p>
<ul>
<li>Focus on transferable skills and achievements</li>
<li>Demonstrate growth and learning progression</li>
<li>Include any leadership or collaboration experiences</li>
</ul>
</div>
</section>
<section>
<h2>PROJECTS</h2>
<div class="project">
<h3>Project Name</h3>
<p>Brief description of what the project accomplishes and technologies used.</p>
<a href="#" target="_blank">View Project</a>
</div>
</section>
</article>
</main>
</body>
</html>
```
</details>
**How to customize am:**
- **Replace** all placeholder text with your real details
- **Adjust** sections according to your experience and career focus
- **Add** or remove sections as you want (like Certifications, Volunteer Work, Languages)
- **Put** links to your real profiles and projects
### Step 5: Create Supporting Files
Professional websites need organized file setup. Create CSS stylesheet and config files wey you need to get complete project.
1. **Hover** your project folder name for Explorer sidebar
2. **Click** the "New File" icon (📄+) wey appear
3. **Create** these files one by one:
- `style.css` (for styling and layout)
- `codeswing.json` (for preview extension config)
**Make the CSS file (`style.css`):**
<details>
<summary><b>Professional CSS Styling</b></summary>
```css
/* Modern Resume Styling */
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
font-size: 16px;
line-height: 1.6;
max-width: 960px;
margin: 0 auto;
padding: 20px;
color: #333;
background-color: #f9f9f9;
}
/* Header Styling */
header {
text-align: center;
margin-bottom: 3em;
padding: 2em;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
border-radius: 10px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
h1 {
font-size: 3em;
letter-spacing: 0.1em;
margin-bottom: 0.2em;
font-weight: 300;
}
.role {
font-size: 1.3em;
font-weight: 300;
margin: 1em 0;
}
/* Main Content Layout */
main {
display: grid;
grid-template-columns: 35% 65%;
gap: 3em;
margin-top: 3em;
background: white;
padding: 2em;
border-radius: 10px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
/* Typography */
h2 {
font-size: 1.4em;
font-weight: 600;
margin-bottom: 1em;
color: #667eea;
border-bottom: 2px solid #667eea;
padding-bottom: 0.3em;
}
h3 {
font-size: 1.1em;
font-weight: 600;
margin-bottom: 0.5em;
color: #444;
}
/* Section Styling */
section {
margin-bottom: 2.5em;
}
#mainLeft {
border-right: 1px solid #e0e0e0;
padding-right: 2em;
}
/* Contact Links */
section a {
color: #667eea;
text-decoration: none;
transition: color 0.3s ease;
}
section a:hover {
color: #764ba2;
text-decoration: underline;
}
/* Icons */
i {
margin-right: 0.8em;
width: 20px;
text-align: center;
color: #667eea;
}
/* Lists */
ul {
list-style: none;
padding-left: 0;
}
li {
margin: 0.5em 0;
padding: 0.3em 0;
position: relative;
}
li:before {
content: "▸";
color: #667eea;
margin-right: 0.5em;
}
/* Work Experience */
.job, .project {
margin-bottom: 2em;
padding-bottom: 1.5em;
border-bottom: 1px solid #f0f0f0;
}
.company {
font-style: italic;
color: #666;
margin-bottom: 0.5em;
}
/* Responsive Design */
@media (max-width: 768px) {
main {
grid-template-columns: 1fr;
gap: 2em;
}
#mainLeft {
border-right: none;
border-bottom: 1px solid #e0e0e0;
padding-right: 0;
padding-bottom: 2em;
}
h1 {
font-size: 2.2em;
}
body {
padding: 10px;
}
}
/* Print Styles */
@media print {
body {
background: white;
color: black;
font-size: 12pt;
}
header {
background: none;
color: black;
box-shadow: none;
}
main {
box-shadow: none;
}
}
```
</details>
**Make the config file (`codeswing.json`):**
```json
{
"scripts": [],
"styles": []
}
```
**Understanding the CSS features:**
- **Uses** CSS Grid for responsive, professional layout
- **Has** modern color schemes with gradient headers
- **Includes** hover effects and smooth transitions for interaction
- **Provides** responsive design wey work for all device sizes
- **Adds** print-friendly styles for PDF generation
### Step 6: Install and Configure Extensions
Extensions go improve your development experience by giving live preview and better workflow tools. CodeSwing extension na one wey good well for web development projects.
**How to install CodeSwing Extension:**
1. **Click** Extensions icon (🧩) for Activity Bar
2. **Search** for "CodeSwing" inside marketplace search box
3. **Select** the CodeSwing extension from search results
4. **Click** blue "Install" button
![Installing the CodeSwing extension](../../../../8-code-editor/images/install-extension.gif)
**Wetin CodeSwing dey give you:**
- **Lets you** preview your website live as you dey edit
- **Shows** changes in real-time without you refresh manually
- **Supports** many file types like HTML, CSS, and JavaScript
- **Gives** integrated development environment experience
**After you install am immediately:**
You go see live preview of your resume website inside editor. This one go help you see exactly how your site dey look as you dey make changes.
![CodeSwing extension showing live preview](../../../../translated_images/after-codeswing-extension-pb.0ebddddcf73b5509.pcm.png)
**How the new interface dey work:**
- **Split view**: **Show** your code for one side and live preview for the other
- **Real-time updates**: **Reflect** changes immediately as you type
- **Interactive preview**: **Allow** you test links and interactions
- **Mobile simulation**: **Give** you responsive design testing tools
### Step 7: Version Control and Publishing
Now your resume website don ready, use Git save your work and put am online.
**How to commit your changes:**
1. **Click** Source Control icon (🌿) for Activity Bar
2. **Review** all files you create or modify inside "Changes" section
3. **Stage** your changes by clicking "+" icon beside each file
4. **Write** commit message wey clear like:
- "Add complete resume website with responsive design"
- "Implement professional styling and content structure"
5. **Click** checkmark (✓) to commit and push your changes
**Good commit message examples:**
- "Add professional resume content and styling"
- "Implement responsive design for mobile compatibility"
- "Update contact information and project links"
> 💡 **Professional Tip**: Good commit messages go help track your project progress and show attention to detail na wetin employers dey value.
**How to access your published site:**
After commit finish, you fit go GitHub repository using hamburger menu (☰) for top-left corner. Your resume website don dey version-controlled and ready for deployment or to share.
## Results and Next Steps
**Congratulations! 🎉** You don successfully create professional resume website with VSCode.dev. Your project dey show:
**Technical skills demonstrated:**
- **Repository management**: Create and organize full project structure
- **Web development**: Build responsive website using modern HTML5 and CSS3
- **Version control**: Follow proper Git workflow with meaningful commits
- **Tool proficiency**: Use VSCode.dev interface and extension system well
**Professional outcomes achieved:**
- **Online presence**: Shareable URL wey show your qualifications
- **Modern format**: Interactive alternative to old-school PDF resumes
- **Demonstrable skills**: Clear proof of your web development abilities
- **Easy updates**: Foundation for you to continuously improve and customize
### Deployment Options
To make your resume easy to access by employers, consider these hosting options:
**GitHub Pages (Recommended):**
1. Go to your repository Settings on GitHub
2. Scroll go "Pages" section
3. Select "Deploy from a branch" and pick "main"
4. Your site go dey available at `https://your-username.github.io/my-resume`
**Other platforms:**
- **Netlify**: Automatic deployment with custom domains
- **Vercel**: Fast deployment with modern hosting features
- **GitHub Codespaces**: Development environment with built-in preview
### Enhancement Suggestions
Keep developing your skills by adding these features:
**Technical improvements:**
- **JavaScript interactivity**: Add smooth scrolling or interactive things
- **Dark mode toggle**: Add theme switching for user choice
- **Contact form**: Make direct communication easy from employers
- **SEO optimization**: Add meta tags and structured data make search better
**Content enhancements:**
- **Project portfolio**: Link to GitHub repositories and live demos
- **Skills visualization**: Create progress bars or skill ratings
- **Testimonials section**: Add recommendations from colleagues or teachers
- **Blog integration**: Add blog section to show your learning journey
## GitHub Copilot Agent Challenge 🚀
Use the Agent mode to complete this challenge:
**Description:** Improve your resume website with advanced features wey show professional web development skills and modern design principles.
**Prompt:** Build from your current resume website, add these advanced features:
1. Add dark/light theme toggle wey get smooth transitions
2. Create interactive skills section with animated progress bars
3. Implement contact form with form validation
4. Add projects portfolio section with hover effects and modal popups
5. Include blog section with at least 3 sample posts about your learning journey
6. Optimize for SEO with correct meta tags, structured data, and performance
7. Deploy the enhanced site using GitHub Pages or Netlify
8. Document all new features for your README.md with screenshots
Your upgraded website suppose show mastery of modern web development practices like responsive design, JavaScript interactivity, and professional deployment workflows.
## Challenge Extension
Wetin you fit try next:
**📱 Mobile-First Redesign:** Build your site again with mobile-first approach using CSS Grid and Flexbox
**🔍 SEO Optimization:** Do full SEO work including meta tags, structured data, and performance optimization
**🌐 Multi-language Support:** Add internationalization so multiple languages fit dey supported
**📊 Analytics Integration:** Add Google Analytics to track visitor engagement and optimize your content
**🚀 Performance Optimization:** Achieve perfect Lighthouse scores for all categories
## Review & Self Study
Expand your knowledge with these resources:
**Advanced VSCode.dev Features:**
- [VSCode.dev Documentation](https://code.visualstudio.com/docs/editor/vscode-web?WT.mc_id=academic-0000-alfredodeza) - Full guide to web-based editing
- [GitHub Codespaces](https://docs.github.com/en/codespaces) - Cloud development environments
**Web Development Best Practices:**
- **Responsive Design**: Learn CSS Grid and Flexbox for modern layouts
- **Accessibility**: Learn WCAG guidelines for inclusive web design
- **Performance**: Explore tools like Lighthouse for optimization
- **SEO**: Understand search engine optimization fundamentals
**Professional Development:**
- **Portfolio Building**: Create additional projects to showcase diverse skills
- **Open Source**: Contribute to existing projects to gain collaboration experience
- **Networking**: Share your resume website in developer communities for feedback
- **Continuous Learning**: Stay updated with web development trends and technologies
---
**Your Next Steps:** Share your resume website with friends, family, or mentors for feedback. Use their suggestions to iterate and improve your design. Remember, this project no be just resume na demonstration of how you don grow as web developer!
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document don translate wit AI translation service wey dem call [Co-op Translator](https://github.com/Azure/co-op-translator). Even tho we dey try make am correct, abeg sabi say automated translation fit get some mistakes or no too correct. Di original document wey dem write for im own language na dat one be the correct source. If na important information, better make human professional translator do am. We no go take responsibility if person no understand or misunderstand tins wey dem see for dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

File diff suppressed because it is too large Load Diff

@ -0,0 +1,20 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "cb549dcad8eea3221cb89793aeaa3bb3",
"translation_date": "2026-01-08T20:38:16+00:00",
"source_file": "9-chat-project/solution/README.md",
"language_code": "pcm"
}
-->
# Run solution
1. Start up di [backend](./backend/README.md)
1. Now start di [fronten](./frontend/README.md)
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document don translate wit AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator). Even though we dey try make am correct, abeg make you sabi say automatic translation fit get some mistakes or wrong tins. Di original document for im own language na di correct source. If na serious matter, make pipo wey sabi translate am well translate am. We no go responsible if person no understand well or if dem misunderstand because of dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,19 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "bcd2c2bbaae71151b1ed1b9170aa78af",
"translation_date": "2026-01-08T20:44:19+00:00",
"source_file": "9-chat-project/solution/backend/README.md",
"language_code": "pcm"
}
-->
Choose your runtime
- [Python](./python/README.md)
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document don translate wit AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator). Even tho we dey try make am correct, abeg sabi say automatic translation fit get some mistakes or wrong tins. Di original document wey dem write for im own language na im be di correct one. If na serious tins, better make human professional translate am. We no go responsible for any wahala or wrong understanding wey fit come from dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,63 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "0aaa930f076f2d83cc872ad157f8ffd3",
"translation_date": "2026-01-08T20:44:58+00:00",
"source_file": "9-chat-project/solution/backend/python/README.md",
"language_code": "pcm"
}
-->
# Run code
## Set up
Create virtual environment
```sh
python -m venv venv
source ./venv/bin/activate
```
## Install dependencies
```sh
pip install openai fastapi uvicorn python-dotenv
```
## Run API
```sh
# Method 1: Run am direct
python api.py
# Method 2: Use uvicorn
uvicorn api:app --host 0.0.0.0 --port 5000 --reload
```
## Test API
Visit di interactive API documentation for: `http://localhost:5000/docs`
## Run frontend
Make sure say you dey for di frontend folder
Find *app.js*, change `BASE_URL` to ur backend URL
Run am
```
npx http-server -p 8000
```
Try type message for di chat, you go see response (if you dey run am for Codespace or you don set up access token).
## Set up access token (if you no run dis for Codespace)
See [Set up PAT](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens)
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**: Dis document na AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator) wey translate am. Even though we try make am correct, abeg sabi say automated translation fit get mistakes or no too correct. Di original document for e own language na di real correct one. If na serious matter, e better make person wey sabi human translation do am. We no go hold ourselves responsible if person no understand or misinterpret from dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,23 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "7746a470be8fc7f736eb1b43ebb710ee",
"translation_date": "2026-01-08T20:39:02+00:00",
"source_file": "9-chat-project/solution/frontend/README.md",
"language_code": "pcm"
}
-->
# Run the code
```sh
npx http-server -p 3000
```
Find the `BASE_URL` for `app.js` and change am to match the URL of the backend.
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**:
Dis document na wetin AI translation service wey dem call [Co-op Translator](https://github.com/Azure/co-op-translator) don translate. Even though we dey try make am correct, abeg sabi say automatic translation fit get some mistakes or no too clear. The original document wey dem write for im own language na im be the real correct one. If na serious matter, better make human professional translate am. We no go take any blame if person no understand well or person carry mistake come because of this translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->

@ -0,0 +1,416 @@
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "a362efd06d64d4134a0cfe8515a86d34",
"translation_date": "2026-01-08T10:21:06+00:00",
"source_file": "AGENTS.md",
"language_code": "pcm"
}
-->
# AGENTS.md
## Project Overview
Dis na one educational curriculum repository wey dey teach web development basics to beginners dem. Di curriculum na full 12-week course wey Microsoft Cloud Advocates develop, get 24 practical lessons wey cover JavaScript, CSS, and HTML.
### Key Components
- **Educational Content**: 24 organized lessons put inside project-based modules
- **Practical Projects**: Terrarium, Typing Game, Browser Extension, Space Game, Banking App, Code Editor, and AI Chat Assistant
- **Interactive Quizzes**: 48 quizzes get 3 questions each (before and after lesson assessments)
- **Multi-language Support**: Automatic translations for more than 50 languages with GitHub Actions
- **Technologies**: HTML, CSS, JavaScript, Vue.js 3, Vite, Node.js, Express, Python (for AI projects)
### Architecture
- Educational repository wey get lesson-based structure
- Each lesson folder get README, code examples, and solutions
- Standalone projects dey different directories (quiz-app, different lesson projects)
- Translation system dey use GitHub Actions (co-op-translator)
- Documentation dey serve with Docsify and e dey available as PDF
## Setup Commands
Dis repository na mostly for educational content use. If you wan work with specific projects:
### Main Repository Setup
```bash
git clone https://github.com/microsoft/Web-Dev-For-Beginners.git
cd Web-Dev-For-Beginners
```
### Quiz App Setup (Vue 3 + Vite)
```bash
cd quiz-app
npm install
npm run dev # Start di development server
npm run build # Build for production
npm run lint # Run ESLint
```
### Bank Project API (Node.js + Express)
```bash
cd 7-bank-project/api
npm install
npm start # Start di API server
npm run lint # Run ESLint
npm run format # Make e fine wit Prettier
```
### Browser Extension Projects
```bash
cd 5-browser-extension/solution
npm install
# Follow di browser-specific extension loading instructions
```
### Space Game Projects
```bash
cd 6-space-game/solution
npm install
# Open index.html for browser or use Live Server
```
### Chat Project (Python Backend)
```bash
cd 9-chat-project/solution/backend/python
pip install openai
# Set GITHUB_TOKEN environment variable
python api.py
```
## Development Workflow
### For Content Contributors
1. **Fork di repository** go your GitHub account
2. **Clone your fork** for your local machine
3. **Create new branch** for your changes dem
4. Change lesson content or code examples
5. Test any code changes for project directories wey concern am
6. Submit pull requests based on how to contribute guideline dem
### For Learners
1. Fork or clone di repository
2. Enter lesson directories one by one
3. Read README files wey dey each lesson
4. Finish pre-lesson quizzes for https://ff-quizzes.netlify.app/web/
5. Work through code examples wey dey lesson folders
6. Finish assignments and challenges dem
7. Do post-lesson quizzes
### Live Development
- **Documentation**: Run `docsify serve` for root (port 3000)
- **Quiz App**: Run `npm run dev` inside quiz-app directory
- **Projects**: Use VS Code Live Server extension for HTML projects
- **API Projects**: Run `npm start` inside correct API directories
## Testing Instructions
### Quiz App Testing
```bash
cd quiz-app
npm run lint # Check for code style wahala
npm run build # Make sure say build work fine
```
### Bank API Testing
```bash
cd 7-bank-project/api
npm run lint # Check for code style wahala
node server.js # Make sure server start no get error
```
### General Testing Approach
- Dis na educational repository wey no get full automated tests
- Manual testing focus on:
- Code examples dey run without wahala
- Links inside documentation dey work well
- Project get successful builds
- Examples dey follow correct way dem
### Pre-submission Checks
- Run `npm run lint` inside directories wey get package.json
- Check say markdown links valid
- Test code examples for browser or Node.js
- Check say translations still keep proper structure
## Code Style Guidelines
### JavaScript
- Use modern ES6+ syntax
- Follow standard ESLint configs wey projects give
- Use meaningful variable and function names so e go dey clear for learners
- Add comments to explain concepts for learners
- Format with Prettier if e dey set
### HTML/CSS
- Use semantic HTML5 elements
- Responsive design principles
- Clear class naming style
- Comments to explain CSS techniques for learners
### Python
- PEP 8 style
- Clear, educational code examples
- Type hints where e fit help learners
### Markdown Documentation
- Clear heading order
- Code blocks with language specification
- Links to more resources
- Screenshots and images dey `images/` directories
- Alt text for images for accessibility
### File Organization
- Lessons get number sequence (1-getting-started-lessons, 2-js-basics, etc.)
- Each project get `solution/` and sometimes `start/` or `your-work/` directories
- Images dey inside lesson-specific `images/` folders
- Translations dey `translations/{language-code}/` folders
## Build and Deployment
### Quiz App Deployment (Azure Static Web Apps)
Quiz-app don set up for Azure Static Web Apps deployment:
```bash
cd quiz-app
npm run build # Dey create dist/ folder
# Dey deploy through GitHub Actions workflow wen e push go main
```
Azure Static Web Apps configuration:
- **App location**: `/quiz-app`
- **Output location**: `dist`
- **Workflow**: `.github/workflows/azure-static-web-apps-ashy-river-0debb7803.yml`
### Documentation PDF Generation
```bash
npm install # Install docsify-to-pdf
npm run convert # Make PDF from docs
```
### Docsify Documentation
```bash
npm install -g docsify-cli # Install Docsify everywhere for system
docsify serve # Run am for localhost:3000
```
### Project-specific Builds
Every project directory fit get their own build process:
- Vue projects: `npm run build` go create production bundles
- Static projects: No build step, serve files direct
## Pull Request Guidelines
### Title Format
Use clear, descriptive titles wey talk which area you change:
- `[Quiz-app] Add new quiz for lesson X`
- `[Lesson-3] Fix typo for terrarium project`
- `[Translation] Add Spanish translation for lesson 5`
- `[Docs] Update setup instructions`
### Required Checks
Before you submit PR:
1. **Code Quality**:
- Run `npm run lint` for project directories wey you change
- Fix all lint errors and warnings
2. **Build Verification**:
- Run `npm run build` if e concern you
- Confirm say no build error
3. **Link Validation**:
- Test all markdown links
- Confirm image references dey work
4. **Content Review**:
- Proofread spelling and grammar
- Confirm code examples correct and educational
- Confirm translations keep original meaning
### Contribution Requirements
- You must agree to Microsoft CLA (automatic check on your first PR)
- Follow the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/)
- See [CONTRIBUTING.md](./CONTRIBUTING.md) for full guidelines
- Put issue numbers for PR description if e concern am
### Review Process
- Maintainers and community go review PRs
- Educational clarity na priority
- Code examples must follow correct best practices
- Translations go get accuracy and cultural check
## Translation System
### Automated Translation
- Uses GitHub Actions with co-op-translator workflow
- Translate to over 50 languages automatically
- Source files dey main directories
- Translated files dey `translations/{language-code}/` folders
### Adding Manual Translation Improvements
1. Find file for `translations/{language-code}/`
2. Make improvements but keep structure proper
3. Make sure code examples still dey work
4. Test any localized quiz content
### Translation Metadata
Translated files get metadata header:
```markdown
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "...",
"translation_date": "...",
"source_file": "...",
"language_code": "..."
}
-->
```
## Debugging and Troubleshooting
### Common Issues
**Quiz app no fit start**:
- Check Node.js version (v14+ na better)
- Delete `node_modules` and `package-lock.json`, then run `npm install` again
- Check if port dey busy (Vite dey use port 5173 by default)
**API server no start**:
- Check Node.js version >=10
- Make sure port no busy
- Ensure all dependencies dey install with `npm install`
**Browser extension no load**:
- Confirm manifest.json correct format
- Check browser console for errors
- Follow browser-specific extension install instruction
**Python chat project wahala**:
- Make sure OpenAI package install: `pip install openai`
- Confirm GITHUB_TOKEN environment variable set
- Check GitHub Models access permissions
**Docsify no dey serve docs**:
- Install docsify-cli globally: `npm install -g docsify-cli`
- Run from root directory of repo
- Confirm `docs/_sidebar.md` dey
### Development Environment Tips
- Use VS Code with Live Server extension for HTML projects
- Install ESLint and Prettier extensions for consistent format
- Use browser DevTools for debug JavaScript
- For Vue projects, install Vue DevTools browser extension
### Performance Considerations
- Plenty translated files (50+ languages) mean big full clones
- Use shallow clone if you dey work only on content: `git clone --depth 1`
- Exclude translations from searches if you dey work on English content
- Build fit slow first time (npm install, Vite build)
## Security Considerations
### Environment Variables
- No put API keys for repository commit
- Use `.env` files (dem dey already `.gitignore`)
- Document needed environment variables for project READMEs
### Python Projects
- Use virtual environments: `python -m venv venv`
- Keep dependencies updated
- GitHub tokens get to get minimal permissions
### GitHub Models Access
- Personal Access Tokens (PAT) needed for GitHub Models
- Store tokens as environment variables
- Never commit tokens or credentials
## Additional Notes
### Target Audience
- Complete beginners for web development
- Students and self-learners
- Teachers use this curriculum for classroom
- Content designed for accessibility and gradual skill build up
### Educational Philosophy
- Project-based learning way
- Frequent knowledge checks (quizzes)
- Hands-on coding exercises
- Real-world application examples
- Focus on fundamentals before frameworks
### Repository Maintenance
- Active community of learners and contributors
- Regular updates to dependencies and content
- Maintainers dey monitor issues and discussions
- Translation updates automatic with GitHub Actions
### Related Resources
- [Microsoft Learn modules](https://docs.microsoft.com/learn/)
- [Student Hub resources](https://docs.microsoft.com/learn/student-hub/)
- [GitHub Copilot](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot) recommended for learners
- Additional courses: Generative AI, Data Science, ML, IoT curricula available
### Working with Specific Projects
For detailed instructions for each project, check README files inside:
- `quiz-app/README.md` - Vue 3 quiz application
- `7-bank-project/README.md` - Banking app with authentication
- `5-browser-extension/README.md` - Browser extension development
- `6-space-game/README.md` - Canvas-based game development
- `9-chat-project/README.md` - AI chat assistant project
### Monorepo Structure
Though e no be traditional monorepo, dis repository get many independent projects:
- Each lesson dey self-contained
- Projects no dey share dependencies
- You fit work for one project without disturb others
- Clone whole repo if you want full curriculum experience
---
<!-- CO-OP TRANSLATOR DISCLAIMER START -->
**Disclaimer**: Dis document na translation we dem use AI translation service [Co-op Translator](https://github.com/Azure/co-op-translator) do am. Even though we dey try make am correct, abeg sabi say machine translation fit get some errors or mistakes. The original document wey dey im own language na di correct one to trust. If na important info, make you use professional human translation. We no go responsible for any wahala or misunderstanding wey fit happen because you use dis translation.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->
Loading…
Cancel
Save