[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/anasmak04/Problem-solving-with-JavaScript/master/problem-18.js [Back]  [Original]

// JavaScript allows you to deep copy an object by converting it into string and then back into object.

let obj = {
   name: 'mehedi',
   address: 'dinajpur',
   mail: 'mehediislamripon@gmail.com',
};

const deepCopy = (obj) => {
   return JSON.parse(JSON.stringify(obj));
};

console.log(deepCopy(obj));

Web Proxy Viewer  |  New URL  |  Original Page