It was a kinda cool thing, although I got some strange behavior when I was using `match` for determining whether the input is a filename - my regex was /.\../ (and so I did var match = i.match(/.\../) ), and match[1] was undefined - turned out match[2] was what I wanted, and it was present, but the behavior was incorrect in the reporting console in the game.
Comments
It was a kinda cool thing, although I got some strange behavior when I was using `match` for determining whether the input is a filename - my regex was /.\../ (and so I did var match = i.match(/.\../) ), and match[1] was undefined - turned out match[2] was what I wanted, and it was present, but the behavior was incorrect in the reporting console in the game.
I finished this in 4 minutes.
Edit: looks like HN doesn't like asterisks
I thought regex was overkill for that one and used:
return input.split(".")[1] || "";
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.
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.