Skip to content

Commit 325dc23

Browse files
duncanhealytargos
authored andcommitted
doc: replace const / var with let
PR-URL: #30446 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
1 parent 58016e0 commit 325dc23

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

test/parallel/test-vm-function-declaration.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,22 @@ const o = vm.createContext({ console });
2828

2929
// Function declaration and expression should both be copied to the
3030
// sandboxed context.
31-
let code = 'var a = function() {};\n';
31+
let code = 'let a = function() {};\n';
3232
code += 'function b(){}\n';
33+
code += 'var c = function() {};\n';
34+
code += 'var d = () => {};\n';
35+
code += 'let e = () => {};\n';
3336

3437
// Grab the global b function as the completion value, to ensure that
3538
// we are getting the global function, and not some other thing
3639
code += '(function(){return this})().b;\n';
3740

3841
const res = vm.runInContext(code, o, 'test');
39-
4042
assert.strictEqual(typeof res, 'function');
4143
assert.strictEqual(res.name, 'b');
42-
assert.strictEqual(typeof o.a, 'function');
44+
assert.strictEqual(typeof o.a, 'undefined');
4345
assert.strictEqual(typeof o.b, 'function');
46+
assert.strictEqual(typeof o.c, 'function');
47+
assert.strictEqual(typeof o.d, 'function');
48+
assert.strictEqual(typeof o.e, 'undefined');
4449
assert.strictEqual(res, o.b);

0 commit comments

Comments
 (0)