Array.join paramaters arents loading

Tell us what’s happening:

I keep getting returned and array without the “-” separator…

Your code so far



var globalTitle = "Winter is Coming";

// Add your code below this line
function urlSlug(title) {
    let mutatedTitle = globalTitle.split(0);
    mutatedTitle.toLowerCase().split((/\W/gi)));
    mutatedTitle.filter((title) => { return title !== '' });
    newStr = mutatedTitle.join('-');

    return newStr;
};


urlSlug(globalTitle);


Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36.

Is this your code?
First it won’t work because:

  1. you have syntax error
    mutatedTitle.toLowerCase().split((/\W/gi)));
    you have too many )
  2. mutatedTitle is an array after you split it, so this code won’t work
    mutatedTitle.toLowerCase()
  3. why you use 0 for split parameter? It didn’t do anything.

yeah this whole thing is a mess. i’m starting over. i got lost. thanks for your help.

Also, split doesn’t change the original atrung but returns an array, so you need to assign its returning value to something