GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — benchmark: use let instead of var in util · nodejs/node@f1d3fb0

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • benchmark/util
    • inspect-array.js
    • inspect.js
    • normalize-encoding.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎benchmark/util/inspect-array.js‎

Copy file name to clipboardExpand all lines: benchmark/util/inspect-array.js
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ const bench = common.createBenchmark(main, {
1515
});
1616

1717
function main({ n, len, type }) {
18-
var arr = Array(len);
19-
var i, opts;
18+
let arr = Array(len);
19+
let opts;
2020

2121
switch (type) {
2222
case 'denseArray_showHidden':
@@ -29,14 +29,14 @@ function main({ n, len, type }) {
2929
case 'sparseArray':
3030
break;
3131
case 'mixedArray':
32-
for (i = 0; i < n; i += 2)
32+
for (let i = 0; i < n; i += 2)
3333
arr[i] = i;
3434
break;
3535
default:
3636
throw new Error(`Unsupported type ${type}`);
3737
}
3838
bench.start();
39-
for (i = 0; i < n; i++) {
39+
for (let i = 0; i < n; i++) {
4040
util.inspect(arr, opts);
4141
}
4242
bench.end(n);
Collapse file

‎benchmark/util/inspect.js‎

Copy file name to clipboardExpand all lines: benchmark/util/inspect.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function benchmark(n, obj, options) {
3737
}
3838

3939
function main({ method, n, option }) {
40-
var obj;
40+
let obj;
4141
const options = opts[option];
4242
switch (method) {
4343
case 'Object':
Collapse file

‎benchmark/util/normalize-encoding.js‎

Copy file name to clipboardExpand all lines: benchmark/util/normalize-encoding.js
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ function getInput(input) {
4646
function main({ input, n }) {
4747
const { normalizeEncoding } = require('internal/util');
4848
const inputs = getInput(input);
49-
var noDead = '';
49+
let noDead = '';
5050

5151
bench.start();
52-
for (var i = 0; i < n; ++i) {
53-
for (var j = 0; j < inputs.length; ++j) {
52+
for (let i = 0; i < n; ++i) {
53+
for (let j = 0; j < inputs.length; ++j) {
5454
noDead = normalizeEncoding(inputs[j]);
5555
}
5656
}

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.