Very new to Javascript and not understanding why my tutorial isn't accepting my code as an answer...
Challenge is to create a function that returns an array after breaking up string into separate words.
Here's what I have so far:
function cutName(namestr) {
var newArray = namestr.split(' ');
return newArray();
}
This seems to work when called, for example returning the following when given this string "hello does this work" as an argument:
[ 'hello', 'does', 'this', 'work' ]
What the heck am I doing wrong here? Shouldn't the above code suffice for an answer?
()to your array variable, its not a function