Date: 2014oct15
Language: javaScript
Q. javaScript: How can I make an array of unsigned 32-bit numbers?
A. As it turns out there is a built-in class for that.
Example 1:
let a = new Uint32Array(256); // Make an empty array of 256 entries
a[100] = 12; // As you'd expect... sets element 100 to 12.
console.log('value=' + a[100]); // print value of element 100
Example 2:
// Create an 4 element array with values 100, 200, 400, 800
let a = new Uint32Array([100, 200, 400, 800]);
Warning! the array does not grow. So this will NOT work:
let a = new Uint32Array();
a[5] = 44; // Does not work.
You can use the set() member to change the array after its created.
Normally numbers in javaScript are 64-bit floats.