Nope, JavaScript doesn't give you that kind of memory level access.

The best thing you can do (which does create a copy) is abuse slice if you want to pass around parts of the array starting at a given spot. Obviously, this only works if you move forward in the array, not backward.

var arr = [1, 2, 3, 4, 5];

// Kinda, sorta but not really create a pointer at a given point in the array
// It doesn't actually refer to the original array. It creates a copy of a subsection of the array
var pretendPointerButNotAtAll = arr.slice(2);

// Almost like doing pointer arithmetic. You get the same value as doing arr[4]
// or arr + 4 in a language with pointers
var elementAtOffset = pretendPointerButNotAtAll[2];
console.log(elementAtOffset);

Answer from Mike Cluck on Stack Overflow
๐ŸŒ
Medium
medium.com โ€บ @auroravaughn โ€บ pointers-pointers-part-1-c9782dbcc304
Pointers โ†’ Pointers -> Part 1. Javascript is accessible through theโ€ฆ | by Aurora Vaughn | Medium
March 21, 2018 - When we add a property to an object or an element to a JavaScript array, we are adding a pointer to the collection of pointers. Whatever resides in the place in memory the property points to has no direct knowledge of the object that is pointing ...
Top answer
1 of 3
3

High level languages, and in particular scripting languages, tend to reference most things with pointers, and they make pointer access transparent. Javascript does this also. Most everything, even primitives like numbers and strings, are objects. Objects in javascript have properties that store things. Those properties are essentially pointers, in that they are references to other objects. Arrays are implemented in the same way, and are in fact objects with numeric properties (and a few utility methods a standard object doesn't have, such as .length, .push(), .map(), etc.). Arrays don't hav a fixed size anymore than objects do. So everything in javascript is stored in these object "buckets" that can store anything in their properties (although you can seal objects, like numbers and strings, so that they don't accidentally change).

Languages with fixed data types (C like languages for instance) implement things with fixed data structures, and the exact size is easily calculable and known. When you declare a variable, the compiler uses the type of that variable to reserve some space in memory. Javascript handles all that for you and doesn't assume anything is a fixed size, because it can't. The size of javascript objects can change at any time.

In C-Like languages, when you ask for an array, you are asking for a block of a specific size. The compiler needs to know how big that is so that it can determine where in memory to put everything, and it can use the type of objects in the array to easily calculate that. Interpreted languages use pointers behind the scenes to keep track of where everything is stored, because they can't assume it will always be in the same place, like a compiled program can. (This is somewhat of a simplification and there are caveats to this of course).

2 of 3
1

You do not have to define the array size before you assign the variables. You can go like:

let array = [];
array.push(12);
array.push("asd");
array.push({data:5});
array.forEach(element => {
    console.log(element);
}); 

Also I think you should not think about pointers with such a high level language. The better way is to look at variables like 'primitives' and 'objects'. Here is a good read about it: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures

๐ŸŒ
Medium
medium.com โ€บ @naveenkarippai โ€บ learning-how-references-work-in-javascript-a066a4e15600
Learning how references work in JavaScript | by Naveen Karippai | Medium
January 14, 2023 - TL;DR: There are NO pointers in JavaScript and references work differently from what we would normally see in most other popular programming languages. In JavaScript, itโ€™s just NOT possible to have a reference from one variable to another variable.
๐ŸŒ
Moogsoft
moogsoft.com โ€บ home โ€บ javascript pointers (they do exist!)
JavaScript has pointers and are a powerful functionality for an engineer
April 5, 2023 - At first glance, there seems to be a conspicuous absence of this functionality for javascript. However, it turns out that there are pointers in JavaScript, but they have just been implemented in a different way. In fact, variables that are an object or an array are always just pointers.
Address: Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
Find elsewhere
๐ŸŒ
CodeSignal
codesignal.com โ€บ learn โ€บ courses โ€บ mastering-algorithms-map-set-and-two-pointers-in-javascript โ€บ lessons โ€บ two-pointer-technique-in-javascript
Two-Pointer Technique in JavaScript
We're going to take a deep dive into an exciting technique โ€” the two-pointer technique. This technique is a crucial skill for enhancing your algorithmic problem-solving abilities, especially when dealing with arrays. In this unit, we'll apply this technique to a problem that involves an array of integers and a target value.
๐ŸŒ
Quora
quora.com โ€บ How-do-I-pass-array-elements-to-a-pointer-variable-in-a-function
How to pass array elements to a pointer variable in a function - Quora
Answer (1 of 3): Call by reference method: Using pointers In this method, address of actual parameters gets copies into formal parameters. In below example, we are passing the address of arrayโ€™s element as an argument to the function, instead of their values. We have to use pointers for this. #...
๐ŸŒ
SlideShare
slideshare.net โ€บ slideshow โ€บ array-of-pointers โ€บ 82305594
Array Of Pointers | PPTX
JavaScript is disabled in your browser ยท Please enable JavaScript to proceed ยท A required part of this site couldnโ€™t load. This may be due to a browser extension, network issues, or browser settings. Please check your connection, disable any ad blockers, or try using a different browser
๐ŸŒ
W3Schools
w3schools.com โ€บ c โ€บ c_pointers_arrays.php
C Pointers and Arrays
This way of working with arrays might seem a bit excessive. Especially with simple arrays like in the examples above. However, for large arrays, it can be much more efficient to access and manipulate arrays with pointers.
๐ŸŒ
DEV Community
dev.to โ€บ corvusetiam โ€บ when-pointers-bite-you-in-javascript-116o
When pointers bite you in Javascript. - DEV Community
August 24, 2019 - I am talking about Date, Array, Object. Anything that is not primitive type. Why primitives just works? Because, they are cheap to copy. Object are not, and you have to force JS, to make copy for you, because it moves around references aka. alias to your stuff. Just like pointers they are not value themselves, but rather something, pointing to your original variable.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ c language โ€บ difference-between-pointer-to-an-array-and-array-of-pointers
Difference between pointer to an array and array of pointers - GeeksforGeeks
July 11, 2025 - : "Array of pointers" is an array of the pointer variables. It is also known as pointer arrays. Syntax: ... We can make separate pointer variables which can point to the different values or we can make one integer array of pointers that can ...
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ c language โ€บ pointer-array-array-pointer
Pointer to an Array | Array Pointer - GeeksforGeeks
On dereferencing a pointer expression, we get a value pointed to by that pointer expression. The pointer to an array point to an array, so on dereferencing it, we should get the array, and the name of the array denotes the base address.
Published: April 30, 2025