ES6对象文字访问和定义

时间:2019-03-21 18:10:55

标签: javascript ecmascript-6 object-literal

大家好,我有一个问题,请回答。

所以我在这里有此代码

function a (ad) {
  const {city, state} = ad;

  const newA = {
    city,
    state,
    country: 'US'
  };
  console.log(`${newA.city}, ${newA.state}, ${newA.country}`)
}

a({city: 'LS', state: 'California'});

console.log(typeof(a));

所以我想知道什么是const {city, state} = ad;变量对象或函数,以及如何使用typeof()函数对其进行访问

先谢谢您

0 个答案:

没有答案
相关问题