Determine File Extensions Using JavaScript

A quick JavaScript function to determine a file's extension.

function fileExt(path) {
    return path.substr(path.lastIndexOf('.') + 1);
}
Author avatar

About the author

Creator of Surreal CMS and other web things. Follow me for tweets about JavaScript, CSS, and web programming.