Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to check if a string is in a string js

// Example 1:
const string = "Hello world!";

n = string.includes("world");

// n is equal to true in Example 1

// Example 2:
const string = "Hello world!, I am Kavyansh";

n = string.includes("I am Aman");
// n is equal to false in Example 2
// Note: the .includes method is case sensitive
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #check #string #string #js
ADD COMMENT
Topic
Name
3+1 =