参考链接:https://blog.csdn.net/zhenyu5665/article/details/72829971
var fileName = "www.aaa.com/index.html"; 方法1 var fileExtension = fileName.substring(fileName.lastIndexOf('.') + 1); 方法2 var fileExtension =fileName.substring(fileName.length-3,fileName.length).toLowerCase(); 方法3 var fileExtension = fileName.split('.').pop().toLowerCase();