I have the following code in Node.js:
var number = parseFloat(-0.8);
var buffer = new Buffer(4);
buffer.writeFloatBE(number, 0);
return -~parseInt(buffer.toString('hex'), 16) - 1;
How can I accomplish the same with ArrayBuffer in normal javascript?
You can reuse IEEE754 writer from Buffer itself (it's now moved to C++ land, link to JS implementation)