Skip to content

Instantly share code, notes, and snippets.

@gabrielhpugliese
Created October 4, 2013 15:44
Show Gist options
  • Select an option

  • Save gabrielhpugliese/6828049 to your computer and use it in GitHub Desktop.

Select an option

Save gabrielhpugliese/6828049 to your computer and use it in GitHub Desktop.
function getFileExtension(i) {
// i will be a string, but it may not have a file extension.
// return the file extension (with no period) if it has one, otherwise false
var splitted = i.split('.');
return splitted.length > 1 && splitted[splitted.length - 1];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment