We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d3ec110 commit 9221303Copy full SHA for 9221303
README.md
@@ -19,4 +19,5 @@
19
| Problem - 15 | Get the Middle Character |
20
| Problem - 16 | Generate random boolean in JavaScript |
21
| Problem - 17 | Find the largest number in Javascript |
22
+| Problem - 18 | Copy an Object deeply |
23
<!-- | Problem - 18 | | -->
problem-18.js
@@ -0,0 +1,13 @@
1
+// JavaScript allows you to deep copy an object by converting it into string and then back into object.
2
+
3
+let obj = {
4
+ name: 'mehedi',
5
+ address: 'dinajpur',
6
+ mail: '[email protected]',
7
+};
8
9
+const deepCopy = (obj) => {
10
+ return JSON.parse(JSON.stringify(obj));
11
12
13
+console.log(deepCopy(obj));
0 commit comments