split filename and extension javascript code example
Example 1: javascript find file extension from string
var ext = fileName.split('.').pop();
Example 2: how to get the extension from filename using javascript
var ext = fileName.substr(fileName.lastIndexOf('.') + 1);