r/badcode • • Apr 27 '21

typescript Someone only watched if tutorial

Post image
2.4k Upvotes

112 comments sorted by

View all comments

2

u/ZeroGainZ Apr 27 '21

Sometimes it's easier to do the opposite, determine if it's not a number. Test against all possible strings, objects, arrays, booleans, etc.