1var fileName = "myDocument.pdf";
2var fileExtension = fileName.split('.').pop(); //"pdf"
1// Use the lastIndexOf method to find the last period in the string, and get the part of the string after that:
2
3var ext = fileName.substr(fileName.lastIndexOf('.') + 1);
4
1var fileName = "myDocument.pdf";
2var fileExtension = fileName.split('.').pop(); //"pdf"