Проблема
Create a function which takes in a sentencestr
and a string of characterschars
and return the sentence but with all the specified characters removed.
Разберитесь в проблеме
Нам нужно, чтобы наша функция выводила что-то вроде этого
stripSentence("the quick brown fox jumps over the lazy dog", "aeiou") ➞ "th qck brwn fx jmps vr th lzy dg"
stripSentence("the hissing snakes sinisterly slither across the rustling leaves", "s") ➞ "the hiing nake initerly lither acro the rutling leave"
stripSentence("gone, reduced to atoms", "go, muscat nerd") ➞ ""
Примечание
Все тесты будут в нижнем регистре.
Решение [1]
const stripSentence = (s,c) => s.replace(RegExp(`[${c}]`,’g’), ‘’)
Решение [2]
const stripSentence = (str, lst) => { return […str].filter(chr => !lst.includes(chr)).join(“”); }
Удачного кодирования !!