javascript split filename and extension 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);