Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
tpanfl457yhate 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:
"Hello World!".split()
>["Hello World!"]
"Hello World!".split('')
>(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 -
tokumei20877y@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?
Related Rants

What only relying on JavaScript for HTML form input validation looks like
Found something true as 1 == 1
what is the difference between .split(), .split('') and .split(' ') ?
question
js
newbie
help