Skip to content

Commit

Permalink
doc: improve examples in buffer docs
Browse files Browse the repository at this point in the history
Documentation for BufferwriteDoubleLE/writeDoubleBE is confusing

PR-URL: #22170
Fixes: #22158
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
  • Loading branch information
pranshuchittora authored and addaleax committed Sep 2, 2018
1 parent e24fc95 commit 9f7efd5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions doc/api/buffer.md
Original file line number Diff line number Diff line change
Expand Up @@ -2145,15 +2145,15 @@ endian). `value` *should* be a valid 64-bit double. Behavior is undefined when
```js
const buf = Buffer.allocUnsafe(8);

buf.writeDoubleBE(0xdeadbeefcafebabe, 0);
buf.writeDoubleBE(123.456, 0);

console.log(buf);
// Prints: <Buffer 43 eb d5 b7 dd f9 5f d7>
// Prints: <Buffer 40 5e dd 2f 1a 9f be 77>

buf.writeDoubleLE(0xdeadbeefcafebabe, 0);
buf.writeDoubleLE(123.456, 0);

console.log(buf);
// Prints: <Buffer d7 5f f9 dd b7 d5 eb 43>
// Prints: <Buffer 77 be 9f 1a 2f dd 5e 40>
```

### buf.writeFloatBE(value, offset)
Expand Down

0 comments on commit 9f7efd5

Please sign in to comment.