其他分享
首页 > 其他分享> > typeScript学习笔记

typeScript学习笔记

作者:互联网

1、变量申明,展开运算符

let defaults = {
  food: 'spicy',
  price: '20',
  ambiance: 'noisy'
}

let search = {...defaults, food: 'rich'}

console.log(search)

{ food: 'rich', price: '20', ambiance: 'noisy' }

let defaults = {
  food: 'spicy',
  price: '20',
  ambiance: 'noisy'
}

let search = {food: 'rich', ...defaults}

console.log(search)

{ food: 'spicy', price: '20', ambiance: 'noisy' }

使用展开运算符的时候,注意顺序

 

   

标签:typeScript,20,food,price,ambiance,笔记,学习,let,noisy
来源: https://www.cnblogs.com/zhaobao1830/p/11298748.html