mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
doc: fix incorrect vm.createContext usage
In code example `vm.createContext` called with new operator by mistake. It is not a constructor. PR-URL: https://github.com/nodejs/node/pull/16059 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
This commit is contained in:
parent
2da7d9b820
commit
4552cf774d
@ -117,7 +117,7 @@ const sandbox = {
|
||||
|
||||
const script = new vm.Script('count += 1; name = "kitty";');
|
||||
|
||||
const context = new vm.createContext(sandbox);
|
||||
const context = vm.createContext(sandbox);
|
||||
for (let i = 0; i < 10; ++i) {
|
||||
script.runInContext(context);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user