javascript check if string contains character
var str = "We got a poop cleanup on isle 4.";
if(str.indexOf("poop") !== -1){
alert("Not again");
}
//use indexOf (it returns position of substring or -1 if not found)var string = "foo",
var substring = "oo";
console.log(string.includes(substring));
Also in JavaScript:
- how to make a css clock
- do i have to include jquery files at head of bootstrap
- jquery script
- on change jquery
- javascript http get request
- .filter js
- javascript math absolute
- three dots in javascript
- toggle class onscroll hook react
- calculate log in javascript
- registeing components in vue
- JQMIGRATE: jQuery.fn.keyup() event shorthand is deprecated
- eslint disable block
- How to make a timer in javascript
- remove punctuation marks from string js
- js copy part of array
- optional chaining
- redirect user to another page javascript
- fetch api with express
- vowels consonants javascript
- add 7 days in date using jquery
- nodejs promise async
- react js installation
- value should be numeric in angular check