kirti patel’s Post

I’ve been writing JavaScript for around 2.6 years now, and looking back, there are a few things I really wish someone had just shown me. Not advanced stuff—just the “why didn’t I know this earlier?” kind of basics 👇 ━━━━━━━━━━━━━━━━━━━ 1️⃣ Optional Chaining (?.) I used to write checks like: if (user && user.profile && user.profile.name) Now it’s just: user?.profile?.name Feels small, but it removes so much noise from the code. ━━━━━━━━━━━━━━━━━━━ 2️⃣ Nullish Coalescing (??) I used to do: const name = user.name || "Guest" But that breaks when value is 0 or empty string. Now: const name = user.name ?? "Guest" This one saved me from so many weird bugs. ━━━━━━━━━━━━━━━━━━━ 3️⃣ Destructuring Earlier: const name = user.name const age = user.age Now: const { name, age } = user Simple change… but code becomes so much easier to scan. ━━━━━━━━━━━━━━━━━━━ 4️⃣ Promise.all() I didn’t realize how slow my code was until I learned this. Instead of waiting one by one: await fetchUsers() await fetchProducts() Now: Promise.all([...]) Everything runs together. Much faster response time. ━━━━━━━━━━━━━━━━━━━ 5️⃣ console.table() This one is underrated. Instead of messy logs everywhere, just: console.table(data) Clean rows, clean columns. Debugging becomes less painful. ━━━━━━━━━━━━━━━━━━━ Nothing fancy here. But honestly, these small things quietly level up your everyday coding. ━━━━━━━━━━━━━━━━━━━ If you’re just starting out, I’d focus on these before jumping into frameworks. They stick with you everywhere — React, Node, anything. ━━━━━━━━━━━━━━━━━━━ What about you? Which one did you start using first? 👇 #JavaScript #WebDevelopment #MERNStack #ReactJS #NodeJS #CodingLife #LearnToCode

To view or add a comment, sign in

Explore content categories