This repository contains a JavaScript code example demonstrating an uncommon error related to null checks. The foo
function throws an error if either a
or b
is null. However, this check is overly strict, as it also throws an error when a
or b
is 0 (a falsy value). This unexpected behavior can be addressed by using the strict equality operator (===
) instead of the loose equality operator (==
).
-
Notifications
You must be signed in to change notification settings - Fork 0
Bug-Hunter-X/Incorrect-Null-Check-in-foo-Function
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Unexpected behavior when a or b is 0, which is falsy, causing the error to be thrown even when it should not be.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published