Query about Spinal Tap

Tell us what’s happening:
Describe your issue in detail here.
It seems like this should be so easy. To convert a string into lower case separating each word with a dash.

However, join(’-’) does nothing. I’ve tried using it on a string and on an array object and it doesn’t work, Judging from what I’ve read on MDN, join() can convert an array like object to a string. I’ve run split() on argument to convert it to an array like object BUT I accomplish nothing with join()…
What am I missing here?

Your code so far


function spinalCase(str) {
let arr = str.toLowerCase();
let array = arr.split().join('-')
console.log(array)
}

spinalCase('This Is Spinal Tap');

Your browser information:

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

Challenge: Spinal Tap Case

Link to the challenge:

Look up the documentation for split on MDN. It requires an argument.

1 Like