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
🌐
AlgoDaily
algodaily.com › lessons › using-the-two-pointer-technique › javascript
AlgoDaily - Daily coding interview questions. Full programming interview prep course and software career coaching.
Programming interview prep bootcamp with coding challenges and practice. Daily coding interview questions. Software interview prep made easy.
🌐
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.
Find elsewhere
🌐
EDUCBA
educba.com › home › software development › software development tutorials › javascript tutorial › pointers in javascript
Pointers in JavaScript | References in JavaScript with Examples
March 31, 2023 - This is a guide to Pointers in JavaScript. Here we discuss the introduction, references in JavaScript and examples respectively.
Address: Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
🌐
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.
🌐
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
🌐
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 ...
🌐
Flylib
flylib.com › books › en › 1.474.1.19 › 1
An Array of Pointers to Pointers | Data Structures Demystified (Demystified)
The contents of the pointer variable is a memory address of another pointer variable. Before we show you how to use an array of pointers to pointers, let s be sure that you understand how arrays, arrays of pointers, and arrays of pointers to pointers join forces to rearrange tons of data efficiently .