let myString = 'this code will work';
// let myArray = ['this', 'code', 'won\'t', 'run', '.'];
if (myString.indexOf('.') == -1){
console.log('I run');
return;
}
Ohhh.. I seeif "." is not found in a string or array, the code in the if statement will run.
Code:let myString = 'this code will work'; // let myArray = ['this', 'code', 'won\'t', 'run', '.']; if (myString.indexOf('.') == -1){ console.log('I run'); return; }
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/indexOf
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf

