Created
June 13, 2014 11:38
-
-
Save tored/ce5690e19f82aaa4371d to your computer and use it in GitHub Desktop.
extension
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function extension(filename) { | |
return filename.split('.').pop(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If filename equals "txt" then the extension popped from the array is "txt".
A solution would be to implement your function as follow :