DEV Community

Discussion on: JavaScript startsWith and multiple conditions

Collapse
 
lexlohr profile image
Alex Lohr

You can also directly use a bound method, i.e.

const result2 = ["Hi", "Hello"].some(string.startsWith.bind(string));
Enter fullscreen mode Exit fullscreen mode
Collapse
 
dailydevtips1 profile image
Chris Bongers

Oh nice one! 🎉