You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Yes, there are 2 easyish ways - Float32Array and DataView.

    DataView is the nicest though:

    var arr = new Uint8Array(4);
    d = new DataView(arr.buffer) ;
    d.setFloat32(0,1234);
    print(arr) // it contains [68, 154, 64, 0]
    

    You can pack lots of different types of data (double,float,int,short,byte,etc) with different endianness, all in the same array. Check out the DataView reference for the various methods: http://www.espruino.com/Reference#DataVi­ew

About

Avatar for Gordon @Gordon started