---
title: "Discussion on \"How to clone an array or object in Javascript\" | Hashnode"
description: "Discussion on \"How to clone an array or object in Javascript\". Primitive data type:For Primitive data types, we do not need to care about copying because when you create a copy, it will be a real copy\n\nLike in the above case, we created a variable a, made a copy of it by just writing b=aEven if you make changes ..."
url: "https://hashnode.com/posts/how-to-clone-an-array-or-object-in-javascript/64568c039621cb659dfbb162"
---

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

Discussion

# [How to clone an array or object in Javascript](https://sahilkumar.hashnode.dev/how-to-clone-an-array-or-object-in-javascript?utm_source=hashnode&utm_medium=feed)

Primitive data type:For Primitive data types, we do not need to care about copying because when you create a copy, it will be a real copy Like in the above case, we created a variable a, made a copy of it by just writing b=aEven if you make changes ...

May 6, 2023 · 4 min read · sahilkumar.hashnode.dev  
Updated May 11, 2023  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#reactjs](https://hashnode.com/tag/reactjs)
-   [#programming-blogs](https://hashnode.com/tag/programming-blogs)
-   [#frontend-development](https://hashnode.com/tag/frontend-development)

## Written by

[Sahil Kumar](https://hashnode.com/@sahilkumar2000)

@sahilkumar2000 · Bangalore, India

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

Web development

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
