how to check the extension of a file in javascript

JavaScript
return filename.split('.').pop();

Source

Also in JavaScript: