function solution(skill, skill_trees) {
let answer = 0;
let filteredTrees = skill_trees.map(tree => {
return tree.split("").filter(el => skill.includes(el))
});
console.log('filteredTrees', filteredTrees)
// 내가 하려던 것이 이거였는데...
// https://velog.io/@highero-k/%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%98%EB%A8%B8%EC%8A%A4-%EC%8A%A4%ED%82%AC%ED%8A%B8%EB%A6%AC-JavaScript-Level-2
for(let i = 0; i < filteredTrees.length; i++) {
let isValid = true;
for(let j = 0; j < filteredTrees[i].length; j++) {
if(skill[j] !== filteredTrees[i][j]) {
isValid = false;
break;
}
}
if(isValid) answer++;
}
return answer;
}