Answers for "javascript check if contains"

23

check for substring javascript

const string = "javascript";
const substring = "script";

console.log(string.includes(substring));  //true
Posted by: Guest on July-06-2020
0

nodejs if contains

if (your_string.indexOf('hello') > -1)
{
  alert("hello found inside your_string");
}
Posted by: Guest on May-06-2021
6

js check if string contains character

"FooBar".includes("oo"); // true

"FooBar".includes("foo"); // false

"FooBar".includes("oo", 2); // false
Posted by: Guest on June-12-2020
34

javascript includes

const pets = ['cat', 'dog', 'bat'];

console.log(pets.includes('cat'));
// output: true
Posted by: Guest on June-12-2020
4

includes in javascript

var colors = ['yellow', 'red', 'pink'];
var string = 'yellow and red are pretty cool';

// outputs false
console.log(colors.include('blue');
// outputs true
console.log(string.includes('yellow');
Posted by: Guest on October-04-2020

Code answers related to "javascript check if contains"

Code answers related to "Javascript"

Browse Popular Code Answers by Language