1684. Count the Number of Consistent Strings
문제
문자열 데이터인 allowed와 배열 words가 매개변수로 주어질 때, words의 원소 중 allowed에 포함되어지는 원소의 개수를 return 하는 함수 만들기
조건
1. words의 길이는 1이상 10,000이하
2. allowed의 길이는 1이상 26이하
3. words[i]의 길이는 1이상 10이하
4. allowed의 각 문자는 유일
5. words[i]와 allowed는 영문 소문자로 이루어짐
풀이
var countConsistentStrings = function(allowed, words) {
const result = words.map((data)=>{
let temp = [...data];
for ( let i of temp ){
if(!allowed.includes(i)) return false;
}
return true;
}).filter((data)=>data===true).length;
return result;
};