Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. // Object Literal ile nesne içinde nesne (nested objects)
  2.  
  3. const o1 = {
  4. w: 'lorem ipsum',
  5. x: 42,
  6. y: 3.14,
  7. g: function () { },
  8. h: function () { },
  9.  
  10. // inner object
  11. ox: {
  12. z: 99,
  13. j: function () { }
  14. }
  15. };
  16.  
  17. // o1 nesnesini kopyalayıp o2 nesnesi oluştur
  18. const o2 = Object.assign({}, o1);
  19.  
  20. // o2 nesnesini kullanıma hazırla
  21. o2.w = 'dolor sit';
  22. o2.x = 45;
  23. o2.y = 2.71;
  24. o2.ox.z = 333; //bu daha başlangıç :)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement