5 ms·
Careful readers of the W3C definition will note that arrays in most languages, like JavaScript, are almost what this definition implies NodeLists are: “ordered
by benihana 15y ago
Careful readers of the W3C definition will note that arrays in most languages, like JavaScript, are almost what this definition implies NodeLists are: “ordered collection of (things)”
What? I think of arrays as contiguous blocks of memory - to me that's their defining feature. Is that incorrect?
- carussell 15y agoIt isn't correct in JS. Arrays aren't aren't guaranteed to be dense, and even if they are, the nature of JS means that they're usually holding references. (Compared to say, a contiguous block of some multiple of sizeof(<some struct>) bytes.)
- DrJ 15y agoW3C is not the programming standard body (is there a such a thing?) But yes, Array in lower(?) level language is suppose to be defined as a contiguous block of memory (C). In more higher level languages what people think are arrays '[ ]' are usually lists (e.g. python)