How to remove all characters of first string from second string in Node.js

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 = "node.js programming";

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



/*
run:

de.s

*/

 



answered Mar 21, 2024 by avibootz

Related questions

1 answer 113 views
1 answer 136 views
2 answers 138 views
1 answer 145 views
1 answer 156 views
...