If I do:
var arr=Uint8Array(1);
arr[0]="hi";
console.log(arr[0]);
The result is 0
instead of "hi"
. That’s because that type of object (Uint8Array
) only admits 8-bit unsigned integers as values for its items.
Is there some type of array-like object made to store only boolean (true
/false
) values?
How can I create an object of that type?
Note: Please, don’t use watch
; it’s not cross-browser. I’m going to use it in any browser.