In all this AI-assisted coding, it’s easy to forget the fundamentals what things actually do and why we use them. A small one I still see misused: ?? vs || in JavaScript. ?? (nullish coalescing) only falls back when the value is null or undefined. || (logical OR) falls back on any falsy value like 0, false, '', NaN, etc. That difference matters more than it looks: 0 || 10 // 10 0 ?? 10 // 0 If 0 or false are valid values in your logic, || can quietly introduce bugs. ?? won’t. Nothing new here but worth remembering. #javascript #javascriptTips
JavaScript ?? vs ||: Understanding the Difference
More Relevant Posts
-
Someone told me that frameworks and libraries are no longer useful for coding. This is because you can now just get Claude to write everything using lower-level CSS, HTML and Javascript. There's no point in "abstractions" because you can just ask AI to do whatever you want. I beg to differ. Good engineering requires understanding what's going on under the hood (so you can fix it when things go south), and this in itself requires abstraction layers. You can't understand how something works fully if you use ordinary Javascript/CSS without any frameworks or libraries. The "spaghetti code" is illegible and bugs difficult to trace. Modern coding is more about putting blocks together (existing, well-tested lower-level blocks) than it is about writing lines of code.
To view or add a comment, sign in
-
Built my own JavaScript polyfills for apply() and bind() today. Recreating core JS methods from scratch gave me a deeper understanding of: • how this works • function context binding • prototypes under the hood • writing cleaner JavaScript Sometimes the best way to grow is to rebuild what you use every day. 🚀 #JavaScript #WebDevelopment #FrontendDevelopment #Coding #SoftwareEngineer #Polyfills #LearnToCode #100DaysOfCode #Developers #InterviewPreparation #AI #GenerativeAI #FutureOfTech
To view or add a comment, sign in
-
-
🚀 Week 6 Backend Dev Challenge: Regular Expressions(Regex) This week, I worked on something that felt both nerdy and surprisingly exciting: validating a credit card number using JavaScript. Yes I know, credit card validation doesn’t sound exciting at first… but once you dive into Regular Expressions, your brain suddenly enters “detective mode.” 😅 I had a Verve card lying around so I decided to use it for this. I made some research and found out Verve cards had different prefixes. Some started with 5060, 5078 and 6500. To validate the card, I had to use a regex pattern. Think of regex as that strict friend who checks every tiny detail before letting anyone into the party. 😂 The pattern I used: ^(5060|5078|6500)[0-9]{12,13}$ What it does: ✅️Makes sure the card number starts with a valid Verve prefix ✅️Ensures the rest are numbers only ✅️Checks that the length is just right and blocks anything that looks suspicious 👀 It’s like building a mini-security gate with code. Instead of writing just a random function, I challenged myself to use Object-Oriented Programming which I’ve been learning recently. So I created a class, added properties, and built a validate() method inside it. Suddenly, my little validator felt more like a program and less like a quick hack. The cool part? Using OOP made it super easy to create multiple card objects: card1 → valid card2 → invalid Each one tested itself, like they had their own personalities. OOP really helps you write cleaner, more organized, and more scalable code. I finally get why people hype it so much. 😄 Honestly, this task made me appreciate how much detail goes into something as “simple” as validating a card number. #JavaScript #LearnToCode #Regex #OOP #CodingJourney #BackendDev
To view or add a comment, sign in
-
I built an in-class self-assessment tool. I’m teaching full-stack development, and we’re currently deep into JavaScript -but I wanted a better way to measure actual understanding, not just passive learning. Each topic includes: 25 challenges • 5 MCQs • 5 True/False • 5 Q&A • 5 “Find the Bug” • 5 “What’s Wrong?” 2 assignments (we break these down together in class) Here’s the interesting part: I built the entire app in ~40 minutes using Claude Code CLI. I fed structured teaching material + my app-building approach into it. and it generated a working product in one go. It’s now: Open source Deployed on Vercel Actively used in physical classes Of course, real-world usage exposed gaps: Poor topic naming (Day-1, Day-2 vs actual concepts like scope, variables, etc.) Assignments bundled in one large file instead of modular structure Challenge types not cleanly separated So now comes the real engineering work: Refactoring early before scale makes it messy. And If I can build this once, I can build it again for: Python, Java, Go… anything. Not just content delivery, but active evaluation systems. AI didn’t do the thinking for me. It just made it ridiculously fast to go from idea → working product. Q: How are you integrating AI into teaching or learning workflows? repo: https://lnkd.in/d-rkTrgP Link: https://lnkd.in/dDWsVCPu #FullStackDevelopment #JavaScript #AI #EdTech #LearningSystems #Developers #OpenSource
To view or add a comment, sign in
-
For a long time, I used to get confused between Throttling and Debouncing in JavaScript. Both sounded similar. Both are used for performance optimization. And honestly, I never had a clear picture of where each one should be used. Today, I finally understood them through a well-organized visual explanation--> and everything clicked. Throttling = Limit repeated execution over time (Useful for scroll, resize, mouse move) Debouncing = Wait until the action stops, then run once (Useful for search bars, typing, input validation) What I liked most is this: Good developers don’t only write features. They also control performance and system behavior. Slowly, I am learning to think beyond code - with a more architectural mindset.
To view or add a comment, sign in
-
-
Stop letting manual code reviews become the bottleneck of your sprint. 🛑 We’ve all been there: a Pull Request sits for hours (or days) because the senior devs are in meetings. When the review finally happens, it's either a "Looks Good To Me" (LGTM) that misses a bug, or a wall of nitpicks that kills momentum. Enter CodeCritic , your AI-powered senior developer that never sleeps. 🚀 I’ve been looking into how teams are scaling their code quality without slowing down, and CodeCritic is a game-changer for modern dev workflows. Why is it different? Unlike basic linters, CodeCritic provides context-aware, narrative feedback that actually explains why a change is needed. Here’s how it levels up your workflow: ✅ Senior-Level Feedback in Seconds: It doesn't just find errors; it suggests cleaner idioms, better structure, and early returns, just like a seasoned pro. ✅ Security & Correctness First: It catches risky APIs, injection vulnerabilities, and edge cases (like off-by-one errors) that humans often skip during a quick scan. ✅ Supports 25+ Languages: From TypeScript and Python to Go, Rust, and even SQL. It auto-detects your stack so you don't have to configure a thing. ✅ Privacy-First: Your code is processed in real-time and never stored or used for training models. Your IP stays yours. The best part? You can start for FREE. Whether you want to paste a quick snippet for a gut check or wire it directly into your GitHub Actions for every PR, it fits right into the tools you already use. Stop guessing if your code is "production-ready" and start shipping with confidence. 🔗 Try it here: https://code-critic.com/ Question for the devs: What’s the most frustrating part of your current code review process? Let’s talk in the comments! 👇 #SoftwareDevelopment #CodeReview #AI #Programming #GitHub #Python #JavaScript #WebDev #EngineeringManagement #CodeCritic #CleanCode
To view or add a comment, sign in
-
"TypeScript isn't just a language; it's magic. Advanced generics and type inference are the spells. Most devs are missing out on this powerful combo." Ever been knee-deep in code, wondering if your types are more complicated than your relationships? You're not alone. But when TypeScript starts predicting your next move better than your playlist? Pure gold. Advanced generics let you weave a safety net so fine, bugs don't stand a chance. And with type inference, it's like your code reads your mind. Imagine shaving hours off debugging because your types do the heavy lifting. I was skeptical at first. But diving into type-level programming flipped the script. It's like a superpower you didn't know you needed. Plus, with AI-assisted development, I can prototype entire features in a fraction of the time. Have you explored TypeScript’s type-level magic? What's your experience been like? #WebDevelopment #TypeScript #Frontend #JavaScript
To view or add a comment, sign in
-
-
Why a 1-line JavaScript trick taught me something AI can't replicate (yet). Recently, while practicing advanced frontend algorithms (specifically, handling complex overlapping string highlights), I stumbled upon a piece of code that completely blew my mind. It was written by a top-tier engineer, He Zhenghao, and it made me realize something profound: this logic was more elegant than an advanced AI model could generate. Here is the context. The challenge was to mark overlapping intervals in a string. The advanced model would use a boolean array and carefully handle boundary conditions during the string assembly: if (isBold[i] && (i === 0 || !isBold[i - 1])) { char = '<b>' + char; } But Zhenghao’s code used 0 and 1 instead of boolean flags, and reduced the logic simply to this: if (isBold[i] === 1 && isBold[i - 1] !== 1) { char = '<b>' + char; } This is a profound mastery of JavaScript's underlying quirks. Unlike Java or C++, accessing an out-of-bounds array index in JS doesn't crash your program; it gracefully returns undefined. And guess what? undefined !== 1 perfectly evaluates to true! The exact same logic seamlessly closes the </b> tag at the end of the string, because isBold[str.length] also returns undefined. He successfully handled all boundary edge cases without writing a single explicit if (i === 0) or length check. This gave me a deep realization: AI excels at providing the "statistical greatest common divisor"—safe, boilerplate, defensive code that translates well across any language. Top human engineers, however, understand the "soul" of a specific language. They know how to leverage its unique quirks to write code that reads like minimalist poetry. In an era where we rely heavily on Copilot, this intuitive grasp of underlying mechanics isn't just about code cleanliness—it's the irreplaceable "Code Taste" of a human engineer. #JavaScript #SoftwareEngineering #ArtificialIntelligence #Frontend
To view or add a comment, sign in
-
Hey, everyone! Lately I've been diving deep into improving my workflow with agentic engineering tools like Claude Code. I've doing so by exploring and building things with programming languages that I never (or barely) touched before like Elixir and Rust. One of those tools which you can even check out right now is a CLI tool called "ccsw" (claude code switcher) which allows you to log into multiple Claude Code accounts while keeping the same session history and context, even between different accounts (here's the repo if that sounds useful to you: https://lnkd.in/dntQqA-Q) And the most interesting thing that I found was that in my TypeScript projects AI works great due to the feedback it receives from running a "typecheck" since it just gives it feedback on what's wrong and what needs fixing. But what about languages that don't have that luxury? That's when LSPs and configuring them properly comes in. If we make it so that agents can interact directly with the same "API" that allow us to see red squiggly lines and errors in our editor, they can self-correct and give way more consistent results. If you're interested in reading more about it, check out the blog post I wrote: https://lnkd.in/dbd4rsJJ
To view or add a comment, sign in
-
I used to spend hours on TypeScript type-level programming — advanced generics and inference tasks. Then I tried vibe coding — letting AI handle the scaffolding while I focused on design. Result: 3x faster prototyping, same code quality. The workflow: 1. Describe the architecture in plain English 2. AI generates the boilerplate 3. I review, refactor, and optimize 4. Ship in days instead of weeks The developers who will thrive in the next 5 years aren't the ones who type the fastest. They're the ones who think the clearest. Have you tried AI-assisted development? What was your experience? #WebDevelopment #TypeScript #Frontend #JavaScript
To view or add a comment, sign in
Explore related topics
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development
Well explained in short and simple way 👏. For those who want to dive deep, can check out this article: https://www.freecodecamp.org/news/nullish-coalescing-operator-in-javascript/