Shallow copy and Deep copy

Shallow Copy When a reference variable is copied into a new reference variable using the assignment operator, a shallow copy of the referenced object is created. In simple words, a reference variable mainly stores the address of the object it refers to. When a new reference variable is assigned the value of the old reference… Continue reading Shallow copy and Deep copy

Combine Two Objects in Javascript

To combine two objects in javascript, we can use the code section given below const posts = { ‘2018-05-11’: { posts: 2 }, ‘2018-05-12’: { posts: 5 }};const notes = { ‘2018-05-11’: { notes: 1 }, ‘2018-05-12’: { notes: 3 }}; function objCombine(obj, variable) {for (let key of Object.keys(obj)) {if (!variable[key]) variable[key] = {}; }}… Continue reading Combine Two Objects in Javascript