Return true if the string in the first element of the array contains all of the letters of the string in the second element of the array.
<script>
console.log(stringContainString(["Alien", "line"])); // true
console.log(stringContainString(["zyxwvutsrqponmlkjihgfedcba", "qrstu"])); // true
console.log(stringContainString(["Hello", "hey"])); // false
function stringContainString(arr) {
return arr[1].toLowerCase()
.split('')
.every(function(letter) {
return arr[0].toLowerCase()
.indexOf(letter) != -1;
});
}
</script>
Most Helpful This Week
How to show hide option list items using jQuery?
How to get selected text from a select box using jQuery?
Using jQuery delete table row on click
jQuery simple form with name and email validations
ES6 method of declaration multiple variables in one line
jQuery move multi select values from one to another multi select list