Javascript string in (includes)

Here a quick example how in javascript the includes function on an string works. In other programming language its also known as “in” or “contains” function.

var data = "Hello world, here is some test string to show the includes method.";
if(data.includes("test")) {
	console.log("The string includes test");
}

Output:

The string includes test

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.