Update palindrome.js

Line 12 fixed code so all spaces will be replaced and not just the first one.

Line 19 and 20 fixed to include newString variable to prevent stack level getting too deep.
Update palindrome.js

Line 12 save split and joined string into new variable.
Merge pull request #3 from zspector/patch-1

Update palindrome.js