How to remove all characters of first string from second string in JavaScript

1 Answer

0 votes
const removeAllCharactersOFFirstStringFromSecond = (first, second) => {
    const arr = second.split("").filter(el => {
        return !first.includes(el);
    });
   
    return arr.join("");
};

const first = "java programming";
const second = "javascript programming";

console.log(removeAllCharactersOFFirstStringFromSecond(first, second));



/*
run:

sct

*/

 



answered Mar 21, 2024 by avibootz
...