Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple APILearn More
AFAIK there is no difference between the first two(the both split at every character) the last one splits at every space char. So "ab ab" becomes ['a', 'b', ' ', 'a', 'b'] for the first two vs ['ab', 'ab'] for the last one
tpanfl482yhate to be that guy but...google it! Or try it yourself, you have a JS console in every browser. You should never be afraid to just go for it with stuff like this!
My tests got me this:
>(12) ["H", "e", "l", "l", "o", " ", "W", "o", "r", "l", "d", "!"]
"Hello World!".split(' ')
>(2) ["Hello", "World!"]
So, looks like no args gives you back your input, blank delimiter gives you back an array of chars, and then a space character is making your delimiter a space, so it will split the word on each space. I'm not super familiar with JS but I'm guessing most of this is right
tokumei23172y@tpanfl FTFY: No args gave you your original input _as the single item in an array_, which conforms with the idea of a split, but tells us that no split was actually performed for that test case.
I'm not a JS developer, furthermore I'm on mobile without access to an interpreter ATM, but maybe split(noargs) does newlines?
dR != SO