From f515d7fed0a8f5a2e13e81ba21099c4aab43f020 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=B5=E3=81=8B=E3=81=AD=E3=81=93?= <67921654+fneco@users.noreply.github.com> Date: Thu, 1 Feb 2024 21:11:09 +0900 Subject: [PATCH] Update binary-data.md Binary notation ("0b") is appropriate instead of hexadecimal notation ("0x"). --- docs/api/binary-data.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/api/binary-data.md b/docs/api/binary-data.md index c6f9df35bb5ac2..98c9a21119330d 100644 --- a/docs/api/binary-data.md +++ b/docs/api/binary-data.md @@ -70,14 +70,14 @@ const buf = new ArrayBuffer(4); const dv = new DataView(buf); dv.setUint8(0, 3); // write value 3 at byte offset 0 dv.getUint8(0); // => 3 -// [0x11, 0x0, 0x0, 0x0] +// [0b00000011, 0b00000000, 0b00000000, 0b00000000] ``` Now let's write a `Uint16` at byte offset `1`. This requires two bytes. We're using the value `513`, which is `2 * 256 + 1`; in bytes, that's `00000010 00000001`. ```ts dv.setUint16(1, 513); -// [0x11, 0x10, 0x1, 0x0] +// [0b00000011, 0b00000010, 0b00000001, 0b00000000] console.log(dv.getUint16(1)); // => 513 ```