Today a colleague of mine randomly asked me if I watch JSConf, to which I responded 'no', and then he told me he found ArrayBuffer powerful. That opened up a gate to a new world for me and as a result led me to your videos about these concepts. This is simply amazing, as are other works done by you. I still remember learning prototypal inheritance from you back in the day.
This was suuuuuper useful for understanding ArrayBuffers, this has been very confusing and it now makes sense to do this rather than to create new Unsigned Integer Arrays from this
Small note: If the number is more than 255 for Uint8Array it will module it. For example, if you pass 257 to Uint8Array it will become 1. Because the values are modulated 257%256 = 1.
Thank you so much, this was so helpful! Today I was looking into the Crypto Web API and got confused since I`ve never really worked with typed arrays. This was incredibly helpful!
Cool video, was playing around a bit and it all made sense :) Was curious what would happen if I tried to assign 1 byte to an array buffer but set the value to int16 which didn't work because it's 2 bytes I guess? Good video!
Please put any tutorial requests here - ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-LCezax2uN3c.html - in the comments and vote for ones that you want.
So to be super clear, Int8Array[x] = y is equivalent to manipulating the DataView corresponding to the TypedArray that the syntax gave me, as in myDataView.set(x) = y (which manipulates myHiddenTypedArray) - is this right?
Using this sample: let dv = new Int8Array([1, 2, 3]); console.log(dv); // Int8Array [1, 2, 3] dv[0] = 127; console.log(dv); // Int8Array [127, 2, 3] We can see that yes it can work like a regular array. new Int8Array( ) is returning a DataView which contains the entire ArrayBuffer created to hold [1, 2, 3]. Try this: dv[0] = 255; console.log( dv ); And see what the value of dv[0] becomes. See if you can work out why.
Steve Griffith haha yay for integer overflow 😃 (the sign bit takes away possible values) - in fact we can’t store anything over 127 in these slots because of that. Using Uint8Array we can store until 255.
@@codeisawesome369 That's correct about the UInt8Array. For the values over 127 in the Int8Array, they actually loop around and start at -128. Trying inserting 128, 129, 256, 257.
@@SteveGriffith-Prof3ssorSt3v3 eyy prof, didn't expect a reply on a 5y old video, me but that's interesting, i didn't expect MacBook clicks to be this loud