---
title: "Discussion on \"Cloning an Object in Javascript: Shallow Copy vs. Deep Copy\" | Hashnode"
description: "Discussion on \"Cloning an Object in Javascript: Shallow Copy vs. Deep Copy\". Have you tried to clone an object in Javascript and the output wasn't what you expected? In this article, I will explain the concepts behind cloning to ensure that you always use the right option.\nShallow copy Vs Deep copy\nThere are two ways to clone..."
url: "https://hashnode.com/posts/cloning-an-object-in-javascript/63f79adcd79d04c62bc51e02"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Cloning an Object in Javascript: Shallow Copy vs. Deep Copy](https://sophy.hashnode.dev/cloning-an-object-in-javascript?utm_source=hashnode&utm_medium=feed)

Have you tried to clone an object in Javascript and the output wasn't what you expected? In this article, I will explain the concepts behind cloning to ensure that you always use the right option. Shallow copy Vs Deep copy There are two ways to clone...

Feb 23, 2023 · 2 min read · sophy.hashnode.dev  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#objects](https://hashnode.com/tag/objects)
-   [#shallowcopy](https://hashnode.com/tag/shallowcopy)
-   [#deepcopy](https://hashnode.com/tag/deepcopy)
-   [#spread-operator](https://hashnode.com/tag/spread-operator)

## Written by

[Chidinma](https://hashnode.com/@Chidinma96)

@Chidinma96 · Lagos,Nigeria

  
[View profile](https://hashnode.com/@Chidinma96)

Hey welcome to my blog, I'm Chidinma a Frontend Web developer.

Hey welcome to my blog, I'm Chidinma a Frontend Web developer.

## Responses 6

Markdown supported · ⌘↵ to post

[Khajappa Biradar](https://hashnode.com/@kcbiradar02)

[May 6, 2024](https://hashnode.com/posts/cloning-an-object-in-javascript/63f79adcd79d04c62bc51e02/comment/6638d40cdc2b1d5e7d6107fe)

Crystal clear!!!

[oladele oyindamolami](https://hashnode.com/@Blackdiamond)

[Mar 9, 2023](https://hashnode.com/posts/cloning-an-object-in-javascript/63f79adcd79d04c62bc51e02/comment/640a29e63e0c5ff6cf7f8909)

Thank you for this tip sis ❤️

[eric](https://hashnode.com/@immutablePanda)

[Feb 24, 2023](https://hashnode.com/posts/cloning-an-object-in-javascript/63f79adcd79d04c62bc51e02/comment/63f7ff4a5ebda1e9aa53a003)

get it

[Chinyere Chinyere](https://hashnode.com/@Calista)

[Feb 23, 2023](https://hashnode.com/posts/cloning-an-object-in-javascript/63f79adcd79d04c62bc51e02/comment/63f7aa855ebda1e9aa539738)

Looking forward to your next article go girl 😍

[Chidinma](https://hashnode.com/@Chidinma96)

[Feb 23, 2023](https://hashnode.com/posts/cloning-an-object-in-javascript/63f79adcd79d04c62bc51e02/comment/63f7aa855ebda1e9aa539738#reply-63f7abaf5ebda1e9aa53977c)

Thanks 🙏

[Dr. Bernd Van linder](https://hashnode.com/@Chimiz)

[Feb 23, 2023](https://hashnode.com/posts/cloning-an-object-in-javascript/63f79adcd79d04c62bc51e02/comment/63f7a10c5ebda1e9aa539610)

You’re a good teacher. Thanks for breaking it down. I look forward to your next article 🙏

[Chidinma](https://hashnode.com/@Chidinma96)

[Feb 23, 2023](https://hashnode.com/posts/cloning-an-object-in-javascript/63f79adcd79d04c62bc51e02/comment/63f7a10c5ebda1e9aa539610#reply-63f7a39c5ebda1e9aa539641)

Thank you 🙏.

[rufai oluwadamilola](https://hashnode.com/@Dammyrikky)

[Feb 23, 2023](https://hashnode.com/posts/cloning-an-object-in-javascript/63f79adcd79d04c62bc51e02/comment/63f79d2c207712e9dab04d05)

This is so insightful and informative ❤️

[Chidinma](https://hashnode.com/@Chidinma96)

[Feb 23, 2023](https://hashnode.com/posts/cloning-an-object-in-javascript/63f79adcd79d04c62bc51e02/comment/63f79d2c207712e9dab04d05#reply-63f79e1e207712e9dab04d40)

Thanks
