Censor words in a sentence
The problem with the first two is that you are assuming separators are spaces but they could potentially be tabs, new lines or punctuation. Although it is easy to split on a non-word character joining them back in is tricky (even multiple spaces will fool the algorithm). Your regex solution has the added problem that it will convert words like kiss to kXXs.

I would stick to the regex, it is shorter and, imo, more readable. You can fix the issue by using a word boundary regex match:

const filter = new RegExp(`\\b(${BANNED.join('|')})\\b`, 'gi')


That said, I would also measure the performance of the three solutions as that is likely to be the biggest concern, especially with longer strings.

Edit 1

An alternative solution using split would be something like:

const censor = (sentence) =&gt;
  sentence.split(/\b/).map(
    (word) =&gt; BANNED.includes(word.toLowerCase()) ? CHAR.repeat(word.length) : word
  ).join('')