我想打印motor.id =购物车值的电机
有人可以帮助我吗?
我的代码在这里
let Carts = ["2","3"];
console.log(Carts)
let a={"id":1,"price":100}
let b={"id":2,"price":200}
let c={"id":3,"price":500}
let d={"id":4,"price":300}
let motors = [a,b,c,d];
console.log(motors)
Carts=motors.filter(function(i){
return i.id==Carts.value
})
console.log(Carts)