Ironically, it is heavily optimized in spite of this. For example, JS arrays are sparse, but runtimes like V8 optimize them to be packed, if possible (if the array contains only integer indices and no holes). Integers also stay integers, if the runtime is fairly confident that they won't suddenly become floats. Moreover, if the runtime finds out that some JS objects don't change their shape (i.e. have the same properties and their inferred types), their relative addresses are cached, so the runtime doesn't need to look them up every single time.
Ironically, it is heavily optimized in spite of this. For example, JS arrays are sparse, but runtimes like V8 optimize them to be packed, if possible (if the array contains only integer indices and no holes). Integers also stay integers, if the runtime is fairly confident that they won't suddenly become floats. Moreover, if the runtime finds out that some JS objects don't change their shape (i.e. have the same properties and their inferred types), their relative addresses are cached, so the runtime doesn't need to look them up every single time.
deleted by creator