0

I am currently javascript developer coming from java, but advancing my knowlendge in data structures & algorithms, so in Java, C, or C++, while declaring array we need to assume its length first like so:

int[] sampleArray = new int[6];

and there are 24 bytes of memory consumed by this array, and we need this because after 24 bytes, there may be some other data type consuming following x bytes. but in javascript we do not need to set the length, and how javascript determines how much memory array will consume?

3
  • In JavaScript, an array is dynamic in size and can be sparse. This question will probably lead you to a better understanding: stackoverflow.com/questions/365975/… Commented Nov 28, 2019 at 15:09
  • stackoverflow.com/questions/20321047/… Commented Nov 28, 2019 at 15:21
  • so to be sure, javascript uses Dynamic Memory Allocation right? Commented Nov 28, 2019 at 15:40

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.