You could also include any required SPI commands at the beginning of the sendData array, and could then use ArrayBufferViews to cut out the data you need without a copy:
var sendData = new Uint8Array(4+256);
sendData.fill(0);
sendData[0] = ...;
sendData[1] = ...;
sendData[2] = ...;
sendData[3] = ...;
// now in the loop:
var result = SPI2.send(sendData);
var data = new Uint8Array(sendData.buffer,4,256);
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
You could also include any required SPI commands at the beginning of the sendData array, and could then use ArrayBufferViews to cut out the data you need without a copy: