Determine file extensions using JavaScript
•
1 min read

Heads up! This post was written in 2008, so it may contain information that is no longer accurate. I keep posts like this around for historical purposes and to prevent link rot, so please keep this in mind as you're reading.
— Cory
A quick JavaScript function to determine a file's extension.
function fileExt(path) {
return path.substr(path.lastIndexOf('.') + 1);
}