r/backtickbot • • Jul 25 '21

https://np.reddit.com/r/javascript/comments/orbt6w/useful_javascript_tricks_and_tips/h6hdkwb/

What's wrong with this trick?

//longhand  
if (x === 'abc' || x === 'def' || x === 'ghi' || x ==='jkl') {  
//logic  
}  
//shorthand  
if (\['abc', 'def', 'ghi', 'jkl'\].includes(x)) {  
   //logic  
}
1 Upvotes

0 comments sorted by