Task 26: Age Checker
Start with Affirmationβ
- "I am destined for greatness. Every step I take brings me closer to my goals. I embrace challenges, knowing they are stepping stones to success. My mind is focused, my heart is determined, and my actions are aligned with my dreams."
Daily Affirmations for Success
- β I am capable, confident, and unstoppable.
- β Success flows to me because I take consistent action.
- β I attract opportunities that align with my purpose.
- β My hard work and persistence create abundance.
- β I am always learning, growing, and evolving.
- β I believe in my potential and trust my journey.
- β I turn setbacks into comebacks with resilience.
- β I am grateful for every success, big and small.
Success Reflectionβ
"Every effort I made today has planted seeds for my future success. I release any doubts and trust the process. My dreams are possible, and I am getting closer every day. I am grateful, I am strong, and I am ready for more!"
πͺ Repeat daily, feel the power, and watch your success unfold!
Task Answer - Video Linkβ
πΉ If you donβt understand the task, watch the video above for the answer.
Taskβ
Step 1β
<h1>π Age Checker</h1>
<input type="number" id="ageInput" placeholder="Enter your age" />
<button id="checkBtn">Can I Drive?</button>
<p id="result"></p>
<script src="script.js"></script>
Step 2β
// Step 1: Get elements from the page
const ageInput = document.getElementById("ageInput");
const checkBtn = document.getElementById("checkBtn");
const result = document.getElementById("result");
// Step 2: Add event listener to the button
checkBtn.addEventListener("click", checkAge);
// Step 3: Create the function to check age
function checkAge() {
const age = parseInt(ageInput.value); // Convert input to number
if (isNaN(age)) {
result.textContent = "β Please enter a valid number.";
} else if (age < 18) {
result.textContent = "π« Sorry, you're not old enough to drive yet!";
} else if (age >= 18 && age < 100) {
result.textContent = "β
Yes, you're old enough to drive!";
} else {
result.textContent = "π§ Are you sure? That's a long driving journey!";
}
}