有人可以帮我这个JavaScript代码吗?

时间:2019-11-30 15:32:21

标签: javascript

我想打印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)

0 个答案:

没有答案
相关问题