Y
Hacker News
new
|
ask
|
show
|
jobs
by
tensafefrogs
4635 days ago
I thought regex was overkill for that one and used:
return input.split(".")[1] || "";
2 comments
dclowd9901
4635 days ago
I fully anticipated a test case like file.name.ext. Of course, you could still do what you're doing, but it'd be a lot more verbose.
link
Bahamut
4635 days ago
What if it had multiple dots? Anyhow, I am on 5 hours of sleep, and already s spent6 hours coding...I just wanted to finish fast.
link