Functional Programming: Split a String into an Array Using the split Method: code does not pass

Tell us what’s happening:
Hello! The below code gives the following output:

[ ‘Hello’, ‘World’, ‘I’, ‘am’, ‘code’ ]
[ ‘Earth’, ‘is’, ‘our’, ‘home’ ]
[ ‘This’, ‘is’, ‘a’, ‘sentence’ ]

But it does not pass the challenge. Can anyone tell me why?

thanks

Your code so far


function splitify(str) {
// Only change code below this line
console.log(str.split(/[^\w]/));

// Only change code above this line
}
splitify("Hello World,I-am code");
splitify("Earth-is-our home");
splitify("This.is.a-sentence");

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36.

Challenge: Split a String into an Array Using the split Method

Link to the challenge:

You forgot to add a return statement in your splitify function without that it just splits and returns nothing.

return str.split(/[^\w]/);

Figured out my own error - had to remove the console.log statement. oops!

@mayankverma, thanks!