Split a String into an Array Using the split Method

Split a String into an Array Using the split Method


Tell us what’s happening:

Your code so far

function splitify(str) {
  // Add your code below this line
  return str.split( '');
  // Add your code above this line
splitify("Hello World,I-am code");

Your browser information:

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

Link to the challenge:


The challenge asks that you split each string into words, but not only by space.
For instance

Hello-World // ["Hello", "World"]

For example you can use a regex that match any non a-z character :slight_smile:
Hope it helps.


if you want by space you must declare ’ ’ space not ‘’ nothing
look at this sites https://regexr.com/ select References and character classes


It is not passing because you forgot to include the period (.)

try this instead.



thanks your help ,just now I find a method split(/\s|\W/)


Yup. That is way better. Welcome.


Hi there, can anyone please tell me, why this did not work? : str.split(/\s+/)


@SamuelJanoska Can you please use the Ask for Help link on the challenge you are working instead of asking your question here?

Thank you.


Even much better: str.split(/\W/)