Last active
September 2, 2021 15:22
-
-
Save luislobo14rap/bf764864c0b894fac073d78c95f791b0 to your computer and use it in GitHub Desktop.
get-extension.js
This file contains hidden or 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
// get-extension.js v1 | |
function getExtension(filename) { | |
if (filename.lastIndexOf('.') > -1) { | |
return filename.substring(filename.lastIndexOf('.') + 1); | |
}; | |
return ''; | |
}; |
This file contains hidden or 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
// getExtension.min.js v1 | |
function getExtension(n){return-1<n.lastIndexOf(".")?n.substring(n.lastIndexOf(".")+1):""} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment