We can find any file extension with function. It will split the characters from last dot and show all characters after that. Please see below working example.
var fileExt = filename.split('.').pop();
If there will be no “.” Dot in value then it will show entire string.
'some_value' = 'some_value'
'.html = 'html'
'../images/myimage.cool.jpg' = 'jpg'