Y
Hacker News
new
|
ask
|
show
|
jobs
by
taternuts
4635 days ago
I have to admit to cheating and putting 'if (i === '.htaccess') return 'htaccess';' to save time :)
1 comments
jrawlings
4635 days ago
I just did
return i.indexOf('.') > -1 ? i.substring(i.indexOf('.')+1) : false;
Seemed to pass all test cases
link
EdgarVerona
4632 days ago
Aye, I did similarly, though for some reason I did >= 0 instead of > -1. I wonder what % of people choose one test approach vs. the other?
link
taternuts
4631 days ago
I chose >= 0, it's fun to learn!
link
return i.indexOf('.') > -1 ? i.substring(i.indexOf('.')+1) : false;
Seemed to pass all test cases