Apply Functional Programming to Convert Strings to URL Slugs... need help!

Tell us what’s happening:

slice() extracts the text from one string and returns a new string. Changes to the text in one string do not affect the other string.

that’s the description of the slice() method on MDN web docs and i’m using it cause in this challenge i shouldn’t modify the globalTitle variable but apparently i’m modifying the variable. anyone mind to explain what i’m doing wrong ?

Your code so far


// The global variable
var globalTitle = " Winter Is  Coming";

// Only change code below this line
function urlSlug(title) {
const str = title.slice(0);
return str.toLowerCase().split(" ").filter(word =>word !== "").join("-");;
}
// Only change code above this line

var winterComing = urlSlug(globalTitle); // Should be "winter-is-coming"
console.log(winterComing);

Your browser information:

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

Challenge: Apply Functional Programming to Convert Strings to URL Slugs

Link to the challenge:

notice the Only change code below this line
you changed the global variable that is above that line

i reset the code and i noticed that i accidentally modified it. thanks !