DEV Community

Discussion on: Use Objects than Arrays For Large Data in JS

captainyossarian profile image

You have described two different data structures: Array and HashMap. Both of them has their own pros and cons. While [lookup] operation in hashmap is faster, hashmap is unordered data structure. It means that there is no guarantee that keys in let objects will be rendered/returned in expected order. It depends on js engine and not on js specification.