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```
@@ -997,7 +997,7 @@ overlapping region within the same `Buffer`
997997``` js
998998const buf = Buffer .allocUnsafe (26 );
999999
1000- for (var i = 0 ; i < 26 ; i++ ) {
1000+ for (let i = 0 ; i < 26 ; i++ ) {
10011001 // 97 is the decimal ASCII value for 'a'
10021002 buf[i] = i + 97 ;
10031003}
@@ -1030,7 +1030,7 @@ const buf = Buffer.from('buffer');
10301030// [3, 102]
10311031// [4, 101]
10321032// [5, 114]
1033- for (var pair of buf .entries ()) {
1033+ for (const pair of buf .entries ()) {
10341034 console .log (pair);
10351035}
10361036```
@@ -1214,7 +1214,7 @@ const buf = Buffer.from('buffer');
12141214// 3
12151215// 4
12161216// 5
1217- for (var key of buf .keys ()) {
1217+ for (const key of buf .keys ()) {
12181218 console .log (key);
12191219}
12201220```
@@ -1304,7 +1304,7 @@ use [`buf.slice()`] to create a new `Buffer`.
13041304Examples:
13051305
13061306``` js
1307- var buf = Buffer .allocUnsafe (10 );
1307+ let buf = Buffer .allocUnsafe (10 );
13081308
13091309buf .write (' abcdefghj' , 0 , ' ascii' );
13101310
@@ -1675,7 +1675,7 @@ one byte from the original `Buffer`
16751675``` js
16761676const buf1 = Buffer .allocUnsafe (26 );
16771677
1678- for (var i = 0 ; i < 26 ; i++ ) {
1678+ for (let i = 0 ; i < 26 ; i++ ) {
16791679 // 97 is the decimal ASCII value for 'a'
16801680 buf1[i] = i + 97 ;
16811681}
@@ -1824,7 +1824,7 @@ Examples:
18241824``` js
18251825const buf1 = Buffer .allocUnsafe (26 );
18261826
1827- for (var i = 0 ; i < 26 ; i++ ) {
1827+ for (let i = 0 ; i < 26 ; i++ ) {
18281828 // 97 is the decimal ASCII value for 'a'
18291829 buf1[i] = i + 97 ;
18301830}
@@ -1899,7 +1899,7 @@ const buf = Buffer.from('buffer');
18991899// 102
19001900// 101
19011901// 114
1902- for (var value of buf .values ()) {
1902+ for (const value of buf .values ()) {
19031903 console .log (value);
19041904}
19051905
@@ -1910,7 +1910,7 @@ for (var value of buf.values()) {
19101910// 102
19111911// 101
19121912// 114
1913- for (var value of buf) {
1913+ for (const value of buf) {
19141914 console .log (value);
19151915}
19161916```
0 commit comments