Here’s how my perfectly planned daily routine turned into a chaotic mess, explained using JavaScript’s top 10 array methods. 🤣
push()
– Planning My Day-(it will increase the length of array and return same array)The night before, I carefully planned my schedule.
let myDay = []; myDay.push("Wake up at 6 AM", "Workout 🏋️", "Healthy breakfast 🥑", "Work on project 💻", "Read a book 📖", "Sleep at 10 PM"); console.log("Planned Day:", myDay);
📝 Plan: A productive, healthy, well-balanced day.
😎 Reality: The plan existed... but my willpower didn’t.shift()
– Snooze Button Wins -(it will remove the first element and reduce array length but return the same array)6 AM Alarm: BEEP BEEP ⏰
Me: Just 5 more minutes…let firstTask = myDay.shift(); console.log("Skipped:", firstTask); // "Wake up at 6 AM"
💤 Reality: Woke up at 10 AM instead.
unshift()
– Emergency Fix -[it will add specified nos of array at begineeing of array ]Now I’m late! Gotta prioritize survival tasks.
myDay.unshift("Panic shower 🚿", "Quick coffee ☕"); console.log("Updated Plan:", myDay);
🔥 Reality: Morning routine reduced to speedrunning life.
pop()
– Goodbye, Productivitylet lastTask = myDay.pop(); console.log("Cancelled:", lastTask); // "Sleep at 10 PM"
🦉 Reality: "Who needs sleep when you have YouTube at 2 AM?"
splice()
– Removing the Gym-[splice(index,nos of elements,items to replace with- can be multiple elements)]Workout? LOL. NO.
let removed = myDay.splice(myDay.indexOf("Workout 🏋️"), 1); console.log("Avoided:", removed);
💪 Reality: Lifting spoon to mouth counts, right?
slice()
– Only Doing Fun StuffWhat if I only did the fun parts of my plan?
let funOnly = myDay.slice(1, 3); console.log("Things I actually did:", funOnly);
🍕 Reality: Breakfast and scrolling memes took priority.
map()
– Adding Excuses to Everythinglet excuses = myDay.map(task => task + " (but later)"); console.log("Procrastination Mode:", excuses);
📜 Reality: "I'll do it... tomorrow." (Famous last words)
filter()
– Removing Boring Stufflet importantStuff = myDay.filter(task => task.includes("Netflix") || task.includes("Food")); console.log("What I actually did:", importantStuff);
📺 Reality: Netflix and eating… priorities, right?
find()
– Last-Minute Productivitylet lastMinuteWork = myDay.find(task => task.includes("Work")); console.log("Almost Did:", lastMinuteWork);
⌛ Reality: Opened my laptop, stared at the screen, then closed it.
reduce()
– Summing Up My Daylet summary = myDay.reduce((acc, task) => acc + " ➡️ " + task); console.log("Final Day Summary:", summary);
🌀 Reality: A beautiful mess, connected by naps and snacks.
Final Thoughts
Planned: Productivity, fitness, self-improvement.
Reality: Chaos, procrastination, and a Netflix marathon.
At least I tried… kinda. 😅