console.log out 在对象中使用模板文字的方法

问题描述

我想注销对象中的所有值。除了“描述”属性的值外,每个值都可以正常注销。

这是我的代码

const cars = {
  make : 'Mazda',year : 2015,model : 'CX-5',style : "SUV",drive : 'AWD',description : function(){
    return `${this.make} ${this.model} is a capable ${this.drive} ${this.style}`
  }
}
const values = Object.values(cars)

for (const value of values){
  console.log(value)
}

它像这样注销

返回${this.make} ${this.model} is a capable ${this.drive} ${this.style};

而不是这个(这就是我想要的)

马自达 CX-5 是一款功能强大的全轮驱动 SUV

我该怎么做才能解决这个问题?我需要一些帮助。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)