I found the cause. There is a module that deep clones complex objects so they can be restored in the future. Can you spot the error in this recursive loop?

function cloneObject(src) {
    let target = {};
    target.__proto__ = src.__proto__;
    for (let prop in src) {
        if (src.hasOwnProperty(prop)) {
            // if the value is a nested object, recursively copy all it's properties
            if (isObject(src[prop])) {
                target[prop] = cloneObject(src[prop]);
            } else {
                target[prop] = src[prop];
            }
        }
    }
    return target;
}

When someArray goes through the cloneObject() function, it creates a new object called Array that does not retain true array properties but instead converts it into an object with proto='Array' (as @CRice pointed out) and nothing more. To fix this we really need to rework the cloneObject function to preserve arrays. This is the corrected deep copy cloneObject function I am now using:

function cloneObject(src) {
    let target = {};
    var isArray = Array.isArray(src);
    if(isArray){
        target = [];
    } else {
        target.__proto__ = src.__proto__;
    }

    for (let prop in src) {
        if (src.hasOwnProperty(prop)) {
            // if the value is a nested object, recursively copy all it's properties
            if (isObject(src[prop])) {
                var propertyValue = cloneObject(src[prop]);
            } else {
                var propertyValue = src[prop];
            }
            
            // if src was an array
            if(isArray){
                target.splice(prop, 0, propertyValue);
            } else {
                target[prop] = propertyValue;
            }
        }
    }
    return target;
}
Answer from Zachary on Stack Overflow
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › types-of-arrays-in-javascript
Types of Arrays in JavaScript - GeeksforGeeks
July 23, 2025 - An array of objects is a array that contains the JavaScript Objects with different properties as elements stored at the different memory locations.
🌐
Code Institute
codeinstitute.net › blog › javascript › javascript arrays
Javascript Arrays: A Guide - Code Institute Global
December 20, 2022 - One variable name is used to access the JavaScript array. To access specific array elements, utilise the index values. An array’s data is often processed using a loop statement, which changes the index value inside the loop’s body to access all of the array’s elements. Processing information in an array requires a few statements. As a result, employing arrays to process data in a programme makes it smaller. There are four types of JavaScript Arrays.
Discussions

Are there different types of Arrays in JavaScript? - Stack Overflow
This is the console output of two different "arrays" made up of the same strings. I do not know how they originated (there is lots of code that I did not write) but I believe only Object2... More on stackoverflow.com
🌐 stackoverflow.com
Why Javascript returns "Array" Data structure as Object. Please explain why Array in JavaScript can store multiple data types.
JavaScript doesn’t do type checking, you can put whatever you want in an array. However of course this can lead to errors and bugs. But that’s the trade off to using JavaScript a simple language that lets you program (no type checking) but this simplicity can lead to bugs or errors. If you really want type checking then I suggest you get typescript, it’s a super set of JavaScript that enforced type checking. More on reddit.com
🌐 r/learnjavascript
13
24
October 1, 2021
JavaScript arrays arent actually arrays at all?
Statically typed languages care a lot about the things that are in the array being of the same type. Dynamically typed languages? Not so much. You can imagine JS arrays as being arrays of references to stuffs ^^ More on reddit.com
🌐 r/learnprogramming
78
48
February 12, 2026
Really helpful illustration of JS array methods
When you've gotten comfortable with map, filter, and reduce your code becomes so much cleaner More on reddit.com
🌐 r/learnjavascript
89
2453
May 29, 2021
🌐
Mozilla
developer.mozilla.org › en-US › docs › Web › JavaScript › Guide › Typed_arrays
JavaScript typed arrays - JavaScript | MDN
Typed arrays are, in principle, fixed-length, so array methods that may change the length of an array are not available. This includes pop, push, shift, splice, and unshift. In addition, flat is unavailable because there are no nested typed arrays, and related methods including concat and flatMap do not have great use cases so are unavailable.
🌐
Medium
medium.com › @julienetienne › different-types-of-arrays-in-javascript-and-when-to-use-them-77f7843b71de
Different Types of Arrays in JavaScript + When to Use Them | by Julien Etienne | Medium
February 8, 2024 - Generic: It’s not tied down to a particular data type. It can be used to store any binary data, whether it represents integers, unsigned integers, floats, unsigned floats and strings. Raw: The representation of ArrayBuffer in JavaScript is consistent with physical memory there is no metadata or transformations.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Array
Array - JavaScript - MDN Web Docs
July 28, 2026 - (When those characteristics are undesirable, use typed arrays instead.) JavaScript arrays are not associative arrays and so, array elements cannot be accessed using arbitrary strings as indexes, but must be accessed using nonnegative integers (or their respective string form) as indexes. JavaScript arrays are zero-indexed: the first element of an array is at index 0, the second is at index 1, and so on — and the last element is at the value of the array's length property minus 1.
🌐
Scientech Easy
scientecheasy.com › home › blog › arrays in javascript
Arrays in JavaScript - Scientech Easy
March 19, 2026 - Ans: Yes, we can. In JavaScript arrays, we can put numbers, strings, booleans, other arrays, and even objects. 5. Is it necessary to put all the values of the same type in an array?
Find elsewhere
🌐
W3Schools
w3schools.com › js › js_arrays.asp
JavaScript Arrays
JavaScript variables can be objects. Arrays are special kinds of objects. Because of this, you can have variables of different types in the same Array.
🌐
Electronic Clinic
electroniclinic.com › js-array-types-of-array-in-javascript-and-their-uses
Js Array, Types of Array in JavaScript and their uses
April 4, 2021 - Tags4 and 3 in one dimensional array which compute the factorial of the values of each element of Js array and print the result 6 7 8 Array in JavaScript Declaring One-Dimensional Js array Dense Array Dense JavaScript Array Dense Js Array Displaying Data From Js array Example write JavaScript code to enter integer type data into an array and then to print the values in reverse order Example write JavaScript code to enter values into one-dimensional array.
🌐
Pressbooks
ecampusontario.pressbooks.pub › webdev › chapter › arrays-and-objects
JavaScript Arrays and Objects – Full Stack Web Development for Beginners
Write simple JavaScript programs using arrays, objects, and arrays of objects. Like most programming languages, JavaScript supports an indexed data type (called an array) for storing ordered lists of values.
🌐
JavaScript Tutorial
javascripttutorial.net › home › javascript tutorial › javascript arrays
JavaScript Array
August 12, 2016 - For example, you can have an array that stores elements with the types number, string, boolean, and null. Second, the size of an array is dynamic and auto-growing. In other words, you don’t need to specify the array size up front.
🌐
Programiz
programiz.com › javascript › array
JavaScript Array (with Examples)
We can find the length of an array using the length property. For example, ... Relationship between arrays and objects in JavaScript. In JavaScript, arrays are a type of object.
🌐
JavaScript.info
javascript.info › tutorial › the javascript language › data types
Arrays
An array is a special kind of object. The square brackets used to access a property arr[0] actually come from the object syntax. That’s essentially the same as obj[key], where arr is the object, while numbers are used as keys. They extend objects providing special methods to work with ordered collections of data and also the length property. But at the core it’s still an object. Remember, there are only eight basic data types in JavaScript ...
🌐
Quora
quora.com › Can-a-JavaScript-array-contain-different-types
Can a JavaScript array contain different types? - Quora
Answer (1 of 3): Yes, an Array can contain anything (an “object” type, a “number” type, a function, null, undefined, etc.) because JavaScript is not a strongly typed language. BUT, internally the engine may use a typed array for optimization, and if the assumption is not correct it ...
🌐
W3Schools
w3schools.com › js › js_typed_arrays.asp
JavaScript Typed Arrays
Typed arrays store elements of Fixed Types like 8-bit integers or 32-bit numbers. ... Typed Arrays were designed to provide an efficient way to handle binary data, unlike traditional JavaScript arrays which can hold elements of mixed data types.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Learn_web_development › Core › Scripting › Arrays
Arrays - Learn web development | MDN
Note: We've said it before, but just as a reminder — JavaScript starts indexing arrays at zero! Note that an array inside an array is called a multidimensional array. You can access an item inside an array that is itself inside another array by chaining two sets of square brackets together.
🌐
JavaScript Institute
javascriptinstitute.org › javascript-tutorial › arrays-in-javascript
Arrays in JavaScript - JavaScript Institute
Hence the need for the JavaScript code to be able to easily manipulate raw binary data in typed arrays. Implementation of typed arrays in JavaScript provides buffers and views. A buffer is an object representing chunk of data with no functionality to access its content.
🌐
Reddit
reddit.com › r/learnprogramming › javascript arrays arent actually arrays at all?
r/learnprogramming on Reddit: JavaScript arrays arent actually arrays at all?
February 12, 2026 -

So I have been learning computer science in college and getting specialized in web development just so I can get a better chance of landing an entry level job and I ran across something that I have been confused about. So in my understanding from my CS courses, an array is a contiguous composite data structure which holds homogeneous values which are ordered with an index. However in JS, arrays are composite data structures which hold heterogeneous values and are ordered with an index. Would an array in JS be closer to a record as far as data structures go or am I putting the cart before the horse in the importance of the allowance of more than one data structure? Is it more important that arrays are index-based by their definition more than it is important that they are homogeneous?

Any and all help would be great, thanks!!