bit, binary, bytes, unicode, ASCII, Typed arrays, buffers & how characters are displayed Flashcards
When will we encounter Typed arrays?
When working with WebGL, Canvas, Web Audio API, xhttpRequets, Fetch API, websockets, Web workers, Media Source API and file APIs
When you created a typed arrays and setup the dataviews to access them what are the values initialized as?
0
What are typed arrays?
Typed Arrays are ways to store a whole bunch of bytes as one big block and access them as if it where an array. Every single byte will be one value you put in an array buffer.
Typed arrays are a good way for javascript to deal with binary data.
What are dataviews used for?
We access typed arrays with a data view that allows us to read and write the values that are inside of the typed arrays.
How do we create a new typed array?
let buffer = new ArrayBuffer(16);
https://www.youtube.com/watch?v=UYkJaW3pmj0
How do we create a new dataview?
let dv = new Dataview(buffer);
What is a byte?
A group of binary digits, a group of 8 bits equals a byte and can represent 255 at a max.
The largest integer that can be represented in one byte is: 11111111 which is 128+64+32+16+8+4+2+1 = 255. Thus, the largest decimal integer you can store in one byte is 255. (in an unsigned byte)
What is a bit?
A bit is the smallest unit of storage. A bit stores a 0 or 1. Anything with two separate states can store 1 bit
In a chip: electric charge = 0/1.
A bit is too small to be much use beyond this.
Typically how much information can be displayed with 1 byte?
1 byte is enough space to hold about 1 typed character e.g B,X, or $
What is ASCII Code?
ASCII is an encoding representing each typed character by a number
Each number is stored in one byte (so the number is in 0..255)
What is Unicode?
“Unicode” is an encoding for mandarin, greek, arabic, etc. languages, typically 2-bytes per “character”
How many bytes can the different measures of storage take?
Kilobyte, KB, about 1 thousand bytes
Megabyte, MB, about 1 million bytes
Gigabyte, GB, about 1 billion bytes
Terabyte, TB, about 1 trillion bytes (rare)
What is a byte used for?
good at using the bits to store information. E.g
Really good for storing characters/letters, images, etc.
Source
https://web.stanford.edu/class/cs101/bits-bytes.html