Y
Hacker News
new
|
ask
|
show
|
jobs
by
film42
1508 days ago
"node".split("").sort.join("")
2 comments
hbn
1507 days ago
This is the correct official answer except you didn't invoke sort
"node".split("").sort().join("")
link
film42
1499 days ago
I write a lot of ruby, I guess...
link
msoad
1508 days ago
wat
link
chrisco255
1508 days ago
Sorting the letters by alphabetical order in "node" by converting each letter to its own string in an array. Slick JavaScript, basically.
link
msoad
1507 days ago
yeah but you need to call sort as a function
link
justbaker
1506 days ago
OP code would throw an exception. ^^
link
"node".split("").sort().join("")