🌐
W3Schools
w3schools.com › jsref › jsref_includes.asp
JavaScript String includes() Method
includes() is an ECMAScript6 (ES6 2015) feature. JavaScript 2015 is supported in all browsers since June 2017: ❮ Previous JavaScript String Reference Next ❯ · ★ +1 · Sign in to track progress · REMOVE ADS · PLUS · SPACES · GET CERTIFIED · FOR TEACHERS · BOOTCAMPS · CONTACT US · × · If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: sales@w3schools.com ·
🌐
W3Schools
w3schools.com › Jsref › jsref_includes.asp
JavaScript String includes() Method - W3Schools
includes() is an ECMAScript6 (ES6 2015) feature. JavaScript 2015 is supported in all browsers since June 2017: ❮ Previous JavaScript String Reference Next ❯ · ★ +1 · Sign in to track progress · REMOVE ADS · PLUS · SPACES · GET CERTIFIED · FOR TEACHERS · BOOTCAMPS · CONTACT US · × · If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: sales@w3schools.com ·
🌐
W3Schools
www-db.deis.unibo.it › courses › TW › DOCS › w3schools › jsref › jsref_includes.asp.html
JavaScript String includes() Method
This method returns true if the string contains the characters, and false if not. Note: The includes() method is case sensitive. ... Color Converter Google Maps Animated Buttons Modal Boxes Modal Images Tooltips Loaders JS Animations Progress Bars Dropdowns Slideshow Side Navigation HTML Includes ...
🌐
W3Schools
w3schools.com › js › js_string_search.asp
JavaScript String Search
let text = "Hello world, welcome to the universe."; text.includes("world", 12); Try it Yourself » ... The startsWith() method returns true if a string begins with a specified value.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › String › includes
String.prototype.includes() - JavaScript | MDN
The includes() method of String values performs a case-sensitive search to determine whether a given string may be found within this string, returning true or false as appropriate.
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › javascript-string-includes-method
JavaScript String includes() Method - GeeksforGeeks
Returns true if the string contains the specified value. Returns false if the value is not found. It is case-sensitive, so uppercase and lowercase letters are treated differently.
Published   March 22, 2018
🌐
W3Schools
w3schools.com › js › js_string_reference.asp
JavaScript String Reference
The reference inludes all JavaScript updates from 1999 to 2025. ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: sales@w3schools.com
🌐
TechOnTheNet
techonthenet.com › js › string_includes.php
JavaScript: String includes() method
This JavaScript tutorial explains how to use the string method called includes() with syntax and examples. In JavaScript, includes() is a string method that determines whether a substring is found in a string.
🌐
Poly Code
polycode.tech › home › javascript › javascript string contains: how to check if a string includes a value
JavaScript String Contains: How to Check If a String Includes a Value - PolyCode
December 5, 2025 - Let’s walk through practical ways to check if one string contains another in JavaScript: Using String.includes() The modern, and most readable, way to check containment is with the includes() method.
Find elsewhere
🌐
Programiz
programiz.com › javascript › library › string › includes
Javascript String includes()
Here, str is a string. ... position (optional) - The position within str to begin searching for searchString. By default, it is 0. Returns true if searchString is found anywhere within str. Returns false if searchString is not found anywhere within str. Note: The includes() method is case sensitive. let sentence = "Java is to JavaScript what Car is to Carpet.";
🌐
JavaScript Tutorial
javascripttutorial.net › home › javascript string methods › string.prototype.includes()
JavaScript String includes() Method
November 3, 2024 - Use the JavaScript String includes() method to perform a case-sensitive search and determine if a substring is included in a string.
🌐
Mimo
mimo.org › glossary › javascript › includes-method
JavaScript includes() method: Syntax, Usage, and Examples
Learn HTML, CSS, JavaScript, and ... functions, objects, and modern ES6+ features ... The includes() method determines whether a string or an array contains a specified value, returning true or false as appropriate....
🌐
freeCodeCamp
forum.freecodecamp.org › javascript
Why includes() works with a string? - JavaScript - The freeCodeCamp Forum
February 21, 2022 - Hello, In MDN doc : " The includes() method determines whether an array includes a certain value among its entries, returning true or false as appropriate." But If I use a string: let string = 'string' console.log(string.includes('i')) That’s ...
🌐
freeCodeCamp
freecodecamp.org › news › javascript-string-contains-how-to-use-js-includes
JavaScript String Contains – How to use JS .includes()
November 5, 2021 - Position 3 until the end of the sentence includes these characters and spaces. ... You can see that the (whole) word "love" is not present in that string. In JavaScript you can use the .includes() method to see if one string is found in another.
🌐
YouTube
youtube.com › watch
String Search Methods - JavaScript Tutorial - w3Schools - Chapter-18 English - YouTube
JavaScript Search MethodsString indexOf()String lastIndexOf()String startsWith()String endsWith()String includes()String match()JavaScript counts positions f
Published   September 6, 2022
Top answer
1 of 16
418

You can use the .some method referenced here.

The some() method tests whether at least one element in the array passes the test implemented by the provided function.

// test cases
const str1 = 'hi hello, how do you do?';
const str2 = 'regular string';
const str3 = 'hello there';

// do the test strings contain these terms?
const conditions = ["hello", "hi", "howdy"];

// run the tests against every element in the array
const test1 = conditions.some(el => str1.includes(el));
const test2 = conditions.some(el => str2.includes(el));
// strictly check that contains 1 and only one match
const test3 = conditions.reduce((a,c) => a + str3.includes(c), 0) == 1;

// display results
console.log(`Loose matching, 2 matches "${str1}" => ${test1}`);
console.log(`Loose matching, 0 matches "${str2}" => ${test2}`);
console.log(`Exact matching, 1 matches "${str3}" => ${test3}`);

Also, as a user mentions below, it is also interesting to match "exactly one" appearance like mentioned above (and requested by OP). This can be done similarly counting the intersections with .reduce and checking later that they're equal to 1.

2 of 16
80

With includes(), no, but you can achieve the same thing with REGEX via test():

var value = /hello|hi|howdy/.test(str);

Or, if the words are coming from a dynamic source:

var words = ['hello', 'hi', 'howdy'];
var value = new RegExp(words.join('|')).test(str);

The REGEX approach is a better idea because it allows you to match the words as actual words, not substrings of other words. You just need the word boundary marker \b, so:

var str = 'hilly';
var value = str.includes('hi'); //true, even though the word 'hi' isn't found
var value = /\bhi\b/.test(str); //false - 'hi' appears but not as its own word
🌐
W3Schools
w3schools.com › js › js_string_methods.asp
JavaScript String Methods
If the separator is omitted, the returned array will contain the whole string in index [0]. If the separator is "", the returned array will be an array of single characters: ... For a complete reference to all JavaScript properties and methods, with full descriptions and many examples, go to: W3Schools' Full JavaScript Reference.
🌐
TutorialsPoint
tutorialspoint.com › home › javascript › javascript string includes method
JavaScript String Includes Method
September 1, 2008 - Original string: Hypertext Markup Language Search string: text Position: 12 Is string 'text' found in 'Hypertext Markup Language' or not? false · As we had discussed earlier, it is a case-sensitive method, so it will treat "hi" and "Hi" as two different values. For example: "hi how are you".includes("Hi") method returns 'false'. <html> <head> <title>JavaScript String includes() Method</title> </head> <body> <script> const str = "hi how are you"; const searchString = "Hi"; document.write("Original string: ", str); document.write("<br>Search string: ", searchString); document.write("<br>Is string '", searchString,"' found in '", str, "' or not?