- split方法
var fileUrl = "http://192.168.30.30:8080/index.html"
var fileName = fileUrl.split('.').pop().toLowerCase();
console.log(fileName)
html
- substring方法
var fileUrl = "http://192.168.30.30:8080/index.html"
var fileName = fileUrl.substring(fileUrl.lastIndexOf('.') + 1)
console.log(fileName)
html