Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Javascript
Posted by: Arvin iuunhao
Added: Jun 18, 2018 8:31 AM
Views: 5
Tags: js
浅克隆对象
  1. const shallowClone = obj => Object.assign({}, obj);
  2. /*
  3. const a = { x: true, y: 1 };
  4. const b = shallowClone(a);
  5. a === b -> false
  6. */