我有将数字转换为字符串的情况。在下面的函数中。我正在迭代对象并尝试更改plan_price. 当我执行 console.log() 时它正在工作
bestPlanArrange(bridals){
let plans = [];
bridals.filter(item => {
item.plans.filter(plan => {
plans.push(plan);
});
})
let obj = {}
let planArr = [];
plans.filter(item => {
item.plan_price.toString()
console.log(item.plan_price) // doesn't listen the code above not working.
console.log(item.plan_price.toString()) // it's working like this.
planArr.push(item) // I want to push after covert.
})
if (planArr[0] != null && plans[0].plan_price != null) {
obj = planArr[0];
}
return obj;
},
我在这里遗漏了什么或做错了什么吗?
largeQ
相关分类