// 截取指定字符前后片段
function getCaption(str, state) {
let index = str.lastIndexOf('=')
state === 0 ? (str = str.substring(0, index)) : (str = str.substring(index + 1, str.length))
return str
}
let arr = ['MM_SMS=33', 'ALI_PAY=24', 'CY_AMIGO=430']
// let value = arr.toString().split(',')
let newArr = []
arr.map(item => {
let a = getCaption(item, 0)
newArr.push(a)
})
console.log(newArr)
console.log(arr) // 不会修改数组