I'm rusty on CS concepts and am watching this review and around 9:00 they talk about arrays being fixed length. This is because they need to tell the stack how much memory to allocate to the structure beforehand so that other memory locations can be allocated elsewhere.
I'm currently a JavaScript developer, but worked with Java in the past. Why is it that a JavaScript array can be dynamically allocated ([].push(element)
)?
I'm asking this from a more deep level perspective- I understand that Arrays in JS are objects with no concept of "length", but it becomes confusing when you can request the length of an array and access its values by index like an Array.
So does that mean JS objects only interact with Heap memory? Is there any concept of fixed length structures in JS?