1- # Buffer
1+ # Buffer
22
33> Stability: 2 - Stable
44
@@ -282,7 +282,7 @@ const buf = Buffer.from([1, 2, 3]);
282282// 1
283283// 2
284284// 3
285- for (var b of buf) {
285+ for (const b of buf) {
286286 console .log (b);
287287}
288288```
@@ -995,7 +995,7 @@ overlapping region within the same `Buffer`
995995``` js
996996const buf = Buffer .allocUnsafe (26 );
997997
998- for (var i = 0 ; i < 26 ; i++ ) {
998+ for (let i = 0 ; i < 26 ; i++ ) {
999999 // 97 is the decimal ASCII value for 'a'
10001000 buf[i] = i + 97 ;
10011001}
@@ -1028,7 +1028,7 @@ const buf = Buffer.from('buffer');
10281028// [3, 102]
10291029// [4, 101]
10301030// [5, 114]
1031- for (var pair of buf .entries ()) {
1031+ for (const pair of buf .entries ()) {
10321032 console .log (pair);
10331033}
10341034```
@@ -1212,7 +1212,7 @@ const buf = Buffer.from('buffer');
12121212// 3
12131213// 4
12141214// 5
1215- for (var key of buf .keys ()) {
1215+ for (const key of buf .keys ()) {
12161216 console .log (key);
12171217}
12181218```
@@ -1302,7 +1302,7 @@ use [`buf.slice()`] to create a new `Buffer`.
13021302Examples:
13031303
13041304``` js
1305- var buf = Buffer .allocUnsafe (10 );
1305+ let buf = Buffer .allocUnsafe (10 );
13061306
13071307buf .write (' abcdefghj' , 0 , ' ascii' );
13081308
@@ -1673,7 +1673,7 @@ one byte from the original `Buffer`
16731673``` js
16741674const buf1 = Buffer .allocUnsafe (26 );
16751675
1676- for (var i = 0 ; i < 26 ; i++ ) {
1676+ for (let i = 0 ; i < 26 ; i++ ) {
16771677 // 97 is the decimal ASCII value for 'a'
16781678 buf1[i] = i + 97 ;
16791679}
@@ -1822,7 +1822,7 @@ Examples:
18221822``` js
18231823const buf1 = Buffer .allocUnsafe (26 );
18241824
1825- for (var i = 0 ; i < 26 ; i++ ) {
1825+ for (let i = 0 ; i < 26 ; i++ ) {
18261826 // 97 is the decimal ASCII value for 'a'
18271827 buf1[i] = i + 97 ;
18281828}
@@ -1897,7 +1897,7 @@ const buf = Buffer.from('buffer');
18971897// 102
18981898// 101
18991899// 114
1900- for (var value of buf .values ()) {
1900+ for (const value of buf .values ()) {
19011901 console .log (value);
19021902}
19031903
@@ -1908,7 +1908,7 @@ for (var value of buf.values()) {
19081908// 102
19091909// 101
19101910// 114
1911- for (var value of buf) {
1911+ for (const value of buf) {
19121912 console .log (value);
19131913}
19141914```
0 commit comments