Skip to content
Advertisement

multiple conditions for JavaScript .includes() method

Just wondering, is there a way to add multiple conditions to a .includes method, for example:

JavaScript

Imagine the comma states “or”.

It’s asking now if the string contains hello, hi or howdy. So only if one, and only one of the conditions is true.

Is there a method of doing that?

Advertisement

Answer

That should work even if one, and only one of the conditions is true :

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement