I have the following code:
function myJoin(array, separator) {
let newStr = array.join(separator).replace("\", "")
return newStr
}
myJoin(['let\'s', 'make', 'a', 'list'], ' ');
I expect the output to be: "let's make a list" but instead it gives me an error.
evalmachine.<anonymous>:21
let newStr = array.join(separator).replace("\", "")
^^
SyntaxError: Invalid or unexpected token
What's wrong with my replace method?
array.join(separator).replace("\\", "")