【发布时间】:2020-11-10 20:58:02
【问题描述】:
我有关于在空格之后获取字符串字符的问题,其中字符串是这样的数组值..
arr = ['aaa: 2' , 'aaa: 5', 'aaa: 6', 3 , 7 , 8];
output = arr.filter(function (p) {
if (!Number(p)) { // get string value
return p.includes('aaa').split(' ').pop();
}
});
console.log(output)
我收到错误“TypeError:p.includes(...).split 不是函数”
如果我删除 .split(' ').pop();
array['aaa: 2','aaa: 5','aaa: 6']
我只想要这样的输出
array [2,5,6]
任何有相同问题经验的人可以帮助我吗?我被困住了。 谢谢各位...
【问题讨论】:
标签: javascript vue.js