Guest User

Untitled

a guest
Feb 24th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. var d1 = {};
  2. d1.f1 = null;
  3. d1.f2 = true;
  4. d1.f3 = 'qwe';d1.f4 = 'dsas';
  5. console.log(d1);
  6. console.log(typeof d1.f1);
  7. console.log(typeof d1.f2);
  8. var e1 = {};
  9. e1.f2 = null;
  10. e1.f4 = 'asd';
  11. for (var f in d1) {
  12. if (d1.hasOwnProperty(f)){
  13. let fv = d1[f];
  14. if ( typeof e1[f] == 'undefined'){
  15. e1[f] = fv;
  16. } if(typeof d1[f] == 'boolean'){
  17. e1[f] = false;
  18. }
  19. }
  20. }
  21.  
  22. console.log(e1);
  23.  
  24. console.log(e1.f5);
  25. }
Add Comment
Please, Sign In to add comment