Simple Exercises to Learn by Doing
Goal: Create a simple webpage about yourself
Task: Create my-first-page.html
<!DOCTYPE html>
<html>
<head>
<title>About Me</title>
</head>
<body>
<h1>Hello, I'm [Your Name]!</h1>
<h2>About Me</h2>
<p>I am learning web development.</p>
<h2>My Hobbies</h2>
<ul>
<li>Reading</li>
<li>Gaming</li>
<li>Coding</li>
</ul>
<button>Say Hello!</button>
</body>
</html>What you learn: Basic HTML tags, structure
Goal: Make your webpage colorful
Task: Add CSS to make it pretty
body {
font-family: Arial, sans-serif;
background-color: lightblue;
margin: 20px;
}
h1 {
color: darkblue;
text-align: center;
}
button {
background-color: orange;
color: white;
padding: 10px 20px;
border: none;
border-radius: 5px;
cursor: pointer;
}
button:hover {
background-color: darkorange;
}What you learn: Colors, fonts, spacing, hover effects
Goal: Make the button do something
Task: Add JavaScript
function sayHello() {
alert("Hello there! Welcome to my page!");
}
// Connect the function to the button
document.querySelector('button').onclick = sayHello;What you learn: Functions, event handling, DOM manipulation
Goal: Build a calculator that adds two numbers
<!DOCTYPE html>
<html>
<head>
<title>My Calculator</title>
</head>
<body>
<h1>Simple Calculator</h1>
<input type="number" id="num1" placeholder="First number">
<input type="number" id="num2" placeholder="Second number">
<button onclick="calculate()">Add Them!</button>
<p id="result">Result will appear here</p>
<script>
function calculate() {
// Get the numbers from input boxes
let number1 = document.getElementById('num1').value;
let number2 = document.getElementById('num2').value;
// Convert to actual numbers and add
let sum = Number(number1) + Number(number2);
// Show the result
document.getElementById('result').innerText = "Result: " + sum;
}
</script>
</body>
</html>What you learn: Input handling, variables, number conversion
Goal: Change background color with buttons
<!DOCTYPE html>
<html>
<head>
<title>Color Changer</title>
</head>
<body id="page">
<h1>Click to Change Colors!</h1>
<button onclick="changeColor('red')">Red</button>
<button onclick="changeColor('blue')">Blue</button>
<button onclick="changeColor('green')">Green</button>
<button onclick="changeColor('yellow')">Yellow</button>
<script>
function changeColor(newColor) {
document.getElementById('page').style.backgroundColor = newColor;
}
</script>
</body>
</html>What you learn: DOM styling, function parameters
Goal: Create a greeting component
// Save as App.jsx
function GreetingCard({ name, age }) {
return (
<div style={{
border: '2px solid blue',
padding: '20px',
margin: '10px',
borderRadius: '10px'
}}>
<h2>Hello, {name}!</h2>
<p>You are {age} years old.</p>
<button onClick={() => alert(`Hi ${name}!`)}>
Say Hi!
</button>
</div>
);
}
function App() {
return (
<div>
<h1>My Friends</h1>
<GreetingCard name="Alice" age="25" />
<GreetingCard name="Bob" age="30" />
<GreetingCard name="Charlie" age="28" />
</div>
);
}
export default App;What you learn: Components, props, JSX, reusability
Goal: Learn React state (memory)
import { useState } from 'react';
function Counter() {
// This is React's memory - it remembers the count
const [count, setCount] = useState(0);
return (
<div style={{ textAlign: 'center', padding: '20px' }}>
<h1>Counter: {count}</h1>
<button onClick={() => setCount(count + 1)}>
Add 1
</button>
<button onClick={() => setCount(count - 1)}>
Subtract 1
</button>
<button onClick={() => setCount(0)}>
Reset
</button>
</div>
);
}
export default Counter;What you learn: useState hook, state management, event handling
Goal: Add and remove items from a list
import { useState } from 'react';
function TodoList() {
const [todos, setTodos] = useState([]);
const [inputText, setInputText] = useState('');
const addTodo = () => {
if (inputText.trim() !== '') {
setTodos([...todos, inputText]);
setInputText(''); // Clear input
}
};
const removeTodo = (indexToRemove) => {
setTodos(todos.filter((_, index) => index !== indexToRemove));
};
return (
<div style={{ padding: '20px' }}>
<h1>My Todo List</h1>
<div>
<input
type="text"
value={inputText}
onChange={(e) => setInputText(e.target.value)}
placeholder="What do you need to do?"
/>
<button onClick={addTodo}>Add Todo</button>
</div>
<ul>
{todos.map((todo, index) => (
<li key={index} style={{ margin: '10px 0' }}>
{todo}
<button
onClick={() => removeTodo(index)}
style={{ marginLeft: '10px' }}
>
Remove
</button>
</li>
))}
</ul>
</div>
);
}
export default TodoList;What you learn: Arrays, mapping, filtering, controlled inputs
Goal: Use Tailwind classes instead of inline styles
function PrettyCard({ title, description, buttonText }) {
return (
<div className="max-w-sm mx-auto bg-white rounded-xl shadow-lg p-6 m-4">
<h2 className="text-2xl font-bold text-gray-800 mb-4">
{title}
</h2>
<p className="text-gray-600 mb-6">
{description}
</p>
<button className="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded transition-colors">
{buttonText}
</button>
</div>
);
}
// Usage
function App() {
return (
<div className="min-h-screen bg-gray-100 py-8">
<PrettyCard
title="Learn React"
description="React makes building UIs fun and easy!"
buttonText="Start Learning"
/>
<PrettyCard
title="Build Projects"
description="Practice by building real applications."
buttonText="See Projects"
/>
</div>
);
}What you learn: Tailwind utility classes, responsive design
Goal: Handle file uploads like in ScanWise Mind
import { useState } from 'react';
function FileUploader() {
const [selectedFile, setSelectedFile] = useState(null);
const [fileContent, setFileContent] = useState('');
const handleFileChange = (event) => {
const file = event.target.files[0];
setSelectedFile(file);
if (file && file.type === 'text/plain') {
// Read text files
const reader = new FileReader();
reader.onload = (e) => {
setFileContent(e.target.result);
};
reader.readAsText(file);
}
};
return (
<div className="p-8">
<h1 className="text-3xl font-bold mb-6">File Uploader</h1>
<div className="border-2 border-dashed border-gray-300 rounded-lg p-6 text-center">
<input
type="file"
onChange={handleFileChange}
accept=".txt,.md"
className="mb-4"
/>
{selectedFile && (
<div className="mt-4">
<p className="font-semibold">Selected File:</p>
<p>Name: {selectedFile.name}</p>
<p>Size: {selectedFile.size} bytes</p>
<p>Type: {selectedFile.type}</p>
</div>
)}
{fileContent && (
<div className="mt-6">
<h3 className="font-semibold mb-2">File Content:</h3>
<textarea
className="w-full h-40 p-3 border rounded"
value={fileContent}
onChange={(e) => setFileContent(e.target.value)}
/>
</div>
)}
</div>
</div>
);
}What you learn: File handling, FileReader API, controlled components
- Day 1-3: HTML exercises (1.1, create more pages)
- Day 4-6: CSS exercises (1.2, try different colors/fonts)
- Day 7-10: JavaScript exercises (1.3, 2.1, 2.2)
- Day 11-14: Combine everything, build a simple website
- Day 1-3: Set up React, do exercise 3.1
- Day 4-6: Master exercise 3.2, try variations
- Day 7-10: Build exercise 4.1, add more features
- Day 11-14: Style with Tailwind (exercise 5.1)
- Day 1-7: File handling (exercise 6.1)
- Day 8-14: Build mini-projects combining everything
Technologies: HTML, CSS, JavaScript Features:
- About me section
- Skills list
- Contact form
- Photo gallery
Technologies: React, API calls Features:
- Search by city
- Display current weather
- 5-day forecast
Technologies: React, Local Storage Features:
- Create/edit notes
- Save to browser storage
- Search notes
- Dark/light theme
Technologies: React, File Upload Features:
- Upload images
- Display in grid
- Delete images
- Image preview
Technologies: React, Tesseract.js Features:
- Upload image
- Extract text
- Edit extracted text
- Save results
Try to recreate parts of ScanWise Mind:
- The upload button
- The file list
- The OCR progress bar
- Animated buttons
- Sound effects
- Confetti when tasks complete
- Dark mode toggle
Make everything work great on phones:
- Touch-friendly buttons
- Swipe gestures
- Responsive layouts
30 minutes: Read/Watch tutorials
60 minutes: Code practice
15 minutes: Review what you learned
15 minutes: Plan tomorrow's learning
- Monday-Wednesday: Learn new concept
- Thursday-Friday: Practice with exercises
- Saturday: Build mini-project
- Sunday: Review and plan next week
- Month 1: Build simple static websites
- Month 2: Create interactive React apps
- Month 3: Add styling and animations
- Month 4: Handle data and APIs
- Month 5: Build full-featured apps
- Month 6: Contribute to open source projects
- Read error messages carefully - they tell you what's wrong
- Google the exact error - someone else had this problem
- Check documentation - official guides are best
- Ask on forums: Stack Overflow, Reddit r/webdev
- Break the problem into smaller pieces
- Discord: Reactiflux, The Programmer's Hangout
- Reddit: r/webdev, r/reactjs, r/learnprogramming
- Twitter: Follow developers, share your progress
- Share your code on GitHub
- Ask for feedback in communities
- Learn from other people's projects
- โ First HTML page
- โ First styled webpage
- โ First interactive button
- โ First React component
- โ First API call
- โ First deployed project
- Post screenshots of your projects
- Write blog posts about what you learned
- Help other beginners
- Contribute to open source
Remember: Every expert was once a beginner!
The key is consistency - code a little bit every day, and you'll be amazed at your progress after just a few months!
Happy coding! ๐