Last active
April 20, 2017 07:27
-
-
Save schan90/df1c519048f2f8af91c989352f26c5eb to your computer and use it in GitHub Desktop.
Daily Toy 2nd-WED. getAllWords
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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