Answers for "function that checks if a string includes a letter js"

34

js includes

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

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

.includes javascript

let storyWords = ['extremely literally actually hi bye okay']
let unnecessaryWords = ['extremely', 'literally', 'actually' ];

let betterWords = storyWords.filter(function(word) {
  return !unnecessaryWords.includes(word);
});
console.log(betterWords) // ['hi' 'bye' 'okay]
Posted by: Guest on June-14-2020
0

js check if string contains character

if (your_string.indexOf('hello') > -1)
{
  alert("hello found inside your_string");
}
Posted by: Guest on June-12-2020

Code answers related to "function that checks if a string includes a letter js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language