---
title: "Discussion on \"Copying array to a new variable in JavaScript\" | Hashnode"
description: "Discussion on \"Copying array to a new variable in JavaScript\". In JavaScript array are reference values, i.e the variable point to a location in memory with the array data. For example:\nlet x = [1,2,3,4,5]\nI have just defined a variable x to holds an array of length 5. I can then assign the value of x to a new v..."
url: "https://hashnode.com/posts/copying-array-to-a-new-variable-in-javascript/62785d52c2a8c278735c8520"
---

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

Discussion

# [Copying array to a new variable in JavaScript](https://elvisakpe.hashnode.dev/copying-array-to-a-new-variable-in-javascript?utm_source=hashnode&utm_medium=feed)

In JavaScript array are reference values, i.e the variable point to a location in memory with the array data. For example: let x = \[1,2,3,4,5\] I have just defined a variable x to holds an array of length 5. I can then assign the value of x to a new v...

May 9, 2022 · 2 min read · elvisakpe.hashnode.dev  
Read the article

-   [#js](https://hashnode.com/tag/js)
-   [#javascript](https://hashnode.com/tag/javascript)
-   [#array](https://hashnode.com/tag/array)
-   [#array-methods](https://hashnode.com/tag/array-methods)

## Written by

[Elvis Imeh](https://hashnode.com/@elvisakpe)

@elvisakpe

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

Software Engineer

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
