Answers for "javascript match against array"

0

javascript match against array

// This long line of expression
x === 'firstmatch' || x === 'secondmatch' || x === 'thirdmatch'

// Can be shortened like this:
['firstmatch', 'secondmatch', 'thirdmatch'].includes(x)
Posted by: Guest on March-08-2022

Code answers related to "javascript match against array"

Code answers related to "Javascript"

Browse Popular Code Answers by Language