参考链接: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();

 

相关文章:

  • 2021-12-03
  • 2021-07-19
  • 2022-12-23
  • 2021-09-07
  • 2021-09-28
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-10-04
  • 2021-12-13
  • 2022-12-23
  • 2021-10-20
  • 2022-12-23
相关资源
相似解决方案