Skip to main content
gamedev.net
🔒 Locked

javascript Uint8Array()

Started by Darkbouncer4689 Aug 28, 2011 at 2:21 AM 0 replies 2.3k views
Original Post
Darkbouncer4689
Darkbouncer4689
Hey all,

I had a quick question about how Uint8Array, Uint16Array and all of the others manage memory.

Uint8Array is suppose to be for unsigned bytes, but if I do the following:

var array = new Uint8Array(1);
array[0] = 1;
console.log(typeof array[0]);

It will say the type is number, which is the type of all javascript number variables (represented as a 64bit floating point number).

It would be really nice to have an array of 8bits instead of 64bits, but when using Uint8Array, will the values actually be stored as a byte?

Thanks for the help!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.