Edit in JSFiddle

var buffer = new ArrayBuffer(100);
var view = new DataView(buffer);

//first arguement -> offset, represent from which byte we want to write the value
//second arguement -> value to be stored
//third arguement -> boolean -> Endianness -> false represents big-endian
//setInt32 represents write the value to 32bits. Value is signed integer. 
view.setInt32(8,22,false);//here we are writing 22 in big-endian after first byte.

//lets retrieve and print the value
var number = view.getInt32(8,false);
document.getElementById("number").innerHTML = number;
<span id='number'></span>