【发布时间】:2019-08-29 10:08:48
【问题描述】:
所以我有数组 ["test1#1", "test2#1", "test3#1", "test4#1", "test5#0"] 我想替换所有#1,然后将它们粘贴回同一数组中的同一位置。
JS:
function catData(array) {
let result = array.map(a => a.TERM + "#" + a.PRIORITY);
result.forEach(d => {
if (d.includes("#1")) {
let less = d.replace("#1", "");
console.log(less);
}
});
console.log(result);
}
【问题讨论】:
标签: javascript