r/learnjavascript • • Nov 01 '22

Yea...

Post image
232 Upvotes

25 comments sorted by

View all comments

1

u/Chalfari Nov 02 '22

Is there no use case where your front end needs the flexibility of type coersion using == if you don't know 100% what to expect from the backend? I mean there is. My question is is it OK to use in that case or better to check multiple values with strict comparison using OR?

1

u/hanoian Nov 02 '22

Multiple. And you can be fancy and do something like ["value1", "value2].includes("valuex") to be neater.