TheOdinProject/javascript-exercises

Palindromes bug

Closed this issue · 3 comments

In my solution, I used the function string.replaceAll, which works when I test it myself.
But using the spec.js tester, it says "replaceAll is not a `function".
pal
pal2

This is a codepen example of the code working

https://codepen.io/miscany/pen/abWBRPb

.replaceAll() is not a function in Node v14, which is the current LTS version and what we use for all our JavaScript code within TOP.

After some research, it looks like your code should work if you replace .replaceAll() with just regular ol' .replace(), since you're already using a regex, which is one of the requirements for have .replace() search for more than the first occurrence of what you want to replace.

Smart man! Thanks for pointing that out wow!