Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var d1 = {};
- d1.f1 = null;
- d1.f2 = true;
- d1.f3 = 'qwe';d1.f4 = 'dsas';
- console.log(d1);
- console.log(typeof d1.f1);
- console.log(typeof d1.f2);
- var e1 = {};
- e1.f2 = null;
- e1.f4 = 'asd';
- for (var f in d1) {
- if (d1.hasOwnProperty(f)){
- let fv = d1[f];
- if ( typeof e1[f] == 'undefined'){
- e1[f] = fv;
- } if(typeof d1[f] == 'boolean'){
- e1[f] = false;
- }
- }
- }
- console.log(e1);
- console.log(e1.f5);
- }
Add Comment
Please, Sign In to add comment