Frédéric's answer worked well for me, however, the function keep erroring out in Chrome console with "Unexpected identifier". The "int" was issue and this modification worked.
function getFileExtension(name){
var found = name.lastIndexOf('.') + 1;
return (parseInt(found) > 0 ? name.substr(found) : "");
}