javascript instring code example
Example 1: check for substring javascript
const string = "javascript";
const substring = "script";
console.log(string.includes(substring));
Example 2: javascript indexof
var colors=["red","green","blue"];
var pos=colors.indexOf("blue");
var str = "We got a poop cleanup on isle 4.";
var strPos = str.indexOf("poop");
Example 3: indexof javascript
var colors=["red","green","blue"];
var pos=colors.indexOf("blue");
var str = "We got a poop cleanup on isle 4.";
var strPos = str.indexOf("poop");
<Checkbox
checked={value.indexOf(option) > -1}
value={option}
/>
Example 4: indexof javascript
Array.indexOf(searchElement, fromIndex)