Hacker News new | ask | show | jobs
by film42 1508 days ago
"node".split("").sort.join("")
2 comments

This is the correct official answer except you didn't invoke sort

"node".split("").sort().join("")

I write a lot of ruby, I guess...
wat
Sorting the letters by alphabetical order in "node" by converting each letter to its own string in an array. Slick JavaScript, basically.
yeah but you need to call sort as a function
OP code would throw an exception. ^^