Example
Search a string for "welcome":
let str = "Hello world, welcome to the universe.";
str.indexOf("welcome") // Returns 13
str.indexOf("Welcome") // Returns -1
Definition and Usage
The indexOf()
method returns the position of the first occurrence of a specified value in a string.
indexOf()
returns -1 if the value is not found.
indexOf()
is case sensitive.
Visitors
that saw a url containing a specific value
Create an audience that visited the pages
url containing “baby”.
if(page.url.indexOf('baby')
!= -1)
{
return true;
}