See code:
var file1 = \"50.xsl\"; var file2 = \"30.doc\"; getFileExtension(file1); //returns xsl getFileExtension(file2); //returns doc function getFileExt
var file = "hello.txt"; var ext = (function(file, lio) { return lio === -1 ? undefined : file.substring(lio+1); })(file, file.lastIndexOf(".")); // hello.txt -> txt // hello.dolly.txt -> txt // hello -> undefined // .hello -> hello