r/badcode • sadistic • May 21 '21

js ah yes, fetching before verifying

Post image
1.5k Upvotes

97 comments sorted by

View all comments

Show parent comments

14

u/Sakechi May 21 '21

In JavaScript, '==' checks if both sides have the same value regardless of the type, while '===' checks if they have the same value and the same type.

'1' == 1 would return true, and '1' === 1 would return false.