JS 判断以指定字符串结尾
function endWith(str, endStr) { str = str.trim() let d = str.length - endStr.length return d >= 0 && str.lastIndexOf(endStr) == d }
let reg = /(.+(?=[]$))/ console.log( 'a '), reg.test(' '))
function endWith(str, endStr) { str = str.trim() let d = str.length - endStr.length return d >= 0 && str.lastIndexOf(endStr) == d }
let reg = /(.+(?=[]$))/ console.log( 'a '), reg.test(' '))