string check javascript
snippet in javascript

string check javascript

user5663

if (typeof myVar === 'string') { /* code */ };

js test if string

user7518

if (typeof string === 'string') { /* code */ };

js check if string contains character

user9315

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

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

"FooBar".includes("oo", 2); // false

js check if string contains character

user4930

if (your_string.indexOf('hello') > -1)
{
  alert("hello found inside your_string");
}