参考链接 https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith
语法:
查看某个字符串是不是以另外一个字符串结尾
String.prototype.endsWith(searchStr [, position])
备注:
position 是String查询的位置, 默认是String.length
eg:
var file_show = '/data/www/liusen/php/girl.gif'; console.log(file_show.endsWith('.gif')); // true console.log(file_show.endsWith('gi')); // false