Working on Array Buffer in nodejs, I read about using views over ArrayBuffer. When we use Int8Array view over nodejs buffer and try to assign 128 to it, the result is that -128 gets displayed in output. Here is the code snippet:
let buffer = new ArrayBuffer(16);
let view = new Int8Array(buffer);
view[0] = 128;
console.log(view);
I am confused about how system could interpret 128 as -128. At some places, I found that since leftmost bit in binary representation of 128 is 1, system treats it as negative number. But if we are using leftmost bit as signed bit, I think we should not use that bit in calculation. So I need clarity about how 128 ultimately shown as -128