Skip to content
Dev.to

8 JavaScript Mistakes I See in Every Code Review...

After reviewing hundreds of PRs, these are the patterns that keep coming up. Let's fix them once and for all. 1. Using == instead of === // 🚫 Wrong - type coercion is unpredictable if (user.age == "18") ... if (count == null) ... if (0 == false) ... // true! if ("" == false) ... // true! // ✅ Correct - strict equality, no surprises if (user.age === 18) ... if (count === null || count === undefined) ... // Or better: if (count == null) ... // Only acceptable for null/undefined check Exception: ==
Read original on dev.to
0
0

Comment

Sign in to join the discussion.

Loading comments…

Related

Liked this? Start your own feed.

Your own feed is waiting.
0
0