JavaScript Program to Merge Property of Two Objects Using Spread Operator

JavaScript Program to Merge Property of Two Objects Using Spread Operator I am very interested to talk to you about this article. The reason is that this article contains very interesting information. Let’s go to this article

JavaScript Program to Merge Property of Two Objects Using Spread Operator

JavaScript Program to Merge Property of Two Objects Using Spread Operator

// program to merge property of two objects

// object 1
const person = {
    name: 'Jack',
    age:26
}

// object 2
const student = {
    gender: 'male'
}

// merge two objects
const newObj = {...person, ...student};

console.log(newObj);

Read Also: JavaScript Program to Count the Number of Keys/Properties in an Object Using Object.key() Method

Final Words

We learned some interesting information through the article JavaScript Program to Merge Property of Two Objects Using Spread Operator. Also if you have any doubts about this article you can report your doubts as a comment box. Thanks

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Deekshi. Here, I post about programming to help developers.

Share on:

Leave a Comment