Guest User

Untitled

a guest
Feb 18th, 2018
340
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. // demostrating spread //
  2. let application = {
  3. 'name': 'devApp',
  4. 'version' : '1.0',
  5. 'email': 'app@gmail.com'
  6. }
  7.  
  8. let duplicateCopy = { ...application };
  9.  
  10. // change the code
  11. application.email = "new@gmail.com";
  12. console.log('application object');
  13. console.log(application);
  14. console.log('shallow copy object');
  15. console.log(duplicateCopy); // still retains app@gmail.com NOT new@gmail.com
Add Comment
Please, Sign In to add comment