Combine an Array into a String Using the join Method error

Combine an Array into a String Using the join Method error
0.0 0

#1

Tell us what’s happening:

i am stuck here

Your code so far


function sentensify(str) {
  // Add your code below this line
   var arr=str.split(/W+/);
  var str = arr.join(" ");
  
  return str;
  // Add your code above this line
}
sentensify("May-the-force-be-with-you");

Your browser information:

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

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method


#2

Hi @ljgpok

I assume you wanted the “Any non-word character” token here. A token starts with a \ so you’d need to change your code to reflect that. At the moment you’re code is looking for 1 or more literal W characters in the string.