Skip to content

Instantly share code, notes, and snippets.

@schan90
Last active April 20, 2017 07:27
Show Gist options
  • Select an option

  • Save schan90/df1c519048f2f8af91c989352f26c5eb to your computer and use it in GitHub Desktop.

Select an option

Save schan90/df1c519048f2f8af91c989352f26c5eb to your computer and use it in GitHub Desktop.
Daily Toy 2nd-WED. getAllWords
function getAllWords(str) {
var emty = [];
if(str.length!==0&&!/^\s/.test(str)) return str.split(" ");
else return emty;
//return emty,str.length,typeof(str);
}
var output1 = getAllWords('Radagast the Brown'),
output2 = getAllWords(' '),
output3 = getAllWords(' jjll');
console.log(output1,output2,output3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment