title: How should I write a byte array representing RGB values in JavaScript?
body: <p>I've been working on a React Native app that is using the <a href="https://github.com/innoveit/react-native-ble-manager" rel="nofollow noreferrer">react-native-ble-manager</a> package. We're trying to write a RGB value to a LED light strip, but we're having issues finding the correct way to format a byte array with RGB values in JavaScript. We were able to get this working in Kotlin by passing this byte array that represents the RGB value of blue:</p>
  <pre><code>val payload = byteArrayOf(0x00, 0xff.toByte(), 0x00 )
  </code></pre>
  <p>I've been trying replicate this in Javascript but I've had no luck getting the LED light strip to change colors like it does for Kotlin. This is the JavaScript code for the byte array I'm passing:</p>
  <pre><code>const payload = new Uint16Array(3);
  payload[0] = 0x00;
  payload[1] = 0xff;
  payload[2] = 0x00;
  </code></pre>
  <p>Can someone please explain how I should write a byte array representing RGB values in JavaScript, and provide the JavaScript equivalent to Kotlin example above(<code>byteArrayOf(0x00, 0xff.toByte(), 0x00 )</code>)?</p>