Created
June 30, 2015 15:32
-
-
Save WillSquire/0ea14469708cc6618dc3 to your computer and use it in GitHub Desktop.
File extension - Retrieves the file extension from a string.
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
/** | |
* Retrieves the file extension from a string. | |
* | |
* @param {string} filename | |
* @returns {string} | |
*/ | |
function fileExtension(filename) { | |
return filename.substr(filename.lastIndexOf('.') + 1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment