Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

133
Views
How to deep copy an object using recursion in JavaScript by making use of Object.create()?

This is my object

const person = {
  name: "Vikram",
  age: 21,
  place: {
    country: "India",
    state: "Karnataka",
  },
  marks: [1, 2, 3, 4],
  parents: {
    father: "Ramesh",
    mother: "Suma",
  },
};
function cloneDeep(obj){} 
 

that should create a deep copy of the provided object using recursion and methods like Object.create etc. Please help me to deep copy this object using recursion.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Yes, you can alter the Object class prototype:

if (!Object.prototype.hasOwnProperty.call(Object.prototype, "deepClone")) {
  Object.prototype.deepClone = () => {
    console.log('clone!')
  };
}

const obj1 = { x: 1 };

obj1.deepClone();

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!