JavaScript || vs ?? Assignment Operators

JavaScript-এ একটা ছোট trick 👇 ```js billingInfo.individual.address ||= billingInfo.billing_address; billingInfo.corporate.address ||= billingInfo.billing_address; billingInfo.individual.address ??= billingInfo.billing_address; billingInfo.corporate.address ??= billingInfo.billing_address; ``` `||=` vs `??=` — differenceটা subtle কিন্তু important 🔥 👉 `||=` → falsy হলেই replace করে (`"", 0, false` সহ) 👉 `??=` → শুধু `null` / `undefined` হলে replace করে Production code-এ wrong choice মানেই hidden bug 😅 আপনি কোনটা prefer করেন — `||=` নাকি `??=` ? 🤔 #JavaScript #CodingTips #CleanCode #WebDev

  • No alternative text description for this image

To view or add a comment, sign in

Explore content categories