Having trouble understanding Int32Array , Int8Array etc;
Hi guys I have recently been “deep diving” into data and how it’s stored in memory lately and really trying to understand at the core how it works. Now I thought I understood how creating a Int32Array would make a new array that has a threshold of 4 bytes per element/member of the array https://mobdro.bio/ .
However, for example, when I access the array and set any of the indexes to, say, a string that would need more than 4 bytes to represent it, it seems it is not quite doing what I thought. Example if I set Int32Array[0] = “hello word”… I figured it would fail to run the code since this string would require more than the allotted bytes to be represented(I think?). I know I’m missing something here and it’s probably quite obvious and I probably need to learn much more, so feel free to point out my silly mistake. Do these arrays only hold Numbers? Perhaps am I supposed to be using this as sort of a character array where each index should only represent a single element? And If that’s the case, what’s the point of having different ones like Int8Array since A single element won’t need more than that anyway (I might be completely wrong and misguided here as well)…?
Haha again I probably messed up a lot of stuff here so feel free to set me straight
Thank you!
Please or to participate in this conversation.