@@ -99,7 +99,7 @@ You can now use the binary addon in a Node.js project `hello.js` by pointing
9999` require ` to the recently built ` hello.node ` module:
100100
101101 // hello.js
102- var addon = require('./build/Release/addon');
102+ const addon = require('./build/Release/addon');
103103
104104 console.log(addon.hello()); // 'world'
105105
@@ -189,7 +189,7 @@ function calls and return a result. This is the main and only needed source
189189You can test it with the following JavaScript snippet:
190190
191191 // test.js
192- var addon = require('./build/Release/addon');
192+ const addon = require('./build/Release/addon');
193193
194194 console.log( 'This should be eight:', addon.add(3,5) );
195195
@@ -237,7 +237,7 @@ adding the function as a property of `exports`.
237237To test it, run the following JavaScript snippet:
238238
239239 // test.js
240- var addon = require('./build/Release/addon');
240+ const addon = require('./build/Release/addon');
241241
242242 addon(function(msg){
243243 console.log(msg); // 'hello world'
@@ -282,7 +282,7 @@ the string passed to `createObject()`:
282282To test it in JavaScript:
283283
284284 // test.js
285- var addon = require('./build/Release/addon');
285+ const addon = require('./build/Release/addon');
286286
287287 var obj1 = addon('hello');
288288 var obj2 = addon('world');
@@ -336,7 +336,7 @@ wraps a C++ function:
336336To test:
337337
338338 // test.js
339- var addon = require('./build/Release/addon');
339+ const addon = require('./build/Release/addon');
340340
341341 var fn = addon();
342342 console.log(fn()); // 'hello world'
@@ -470,7 +470,7 @@ prototype:
470470Test it with:
471471
472472 // test.js
473- var addon = require('./build/Release/addon');
473+ const addon = require('./build/Release/addon');
474474
475475 var obj = new addon.MyObject(10);
476476 console.log( obj.plusOne() ); // 11
@@ -630,7 +630,7 @@ The implementation is similar to the above in `myobject.cc`:
630630Test it with:
631631
632632 // test.js
633- var createObject = require('./build/Release/addon');
633+ const createObject = require('./build/Release/addon');
634634
635635 var obj = createObject(10);
636636 console.log( obj.plusOne() ); // 11
@@ -792,7 +792,7 @@ The implementation of `myobject.cc` is similar to before:
792792Test it with:
793793
794794 // test.js
795- var addon = require('./build/Release/addon');
795+ const addon = require('./build/Release/addon');
796796
797797 var obj1 = addon.createObject(10);
798798 var obj2 = addon.createObject(20);
@@ -866,7 +866,7 @@ The file `addon.cc` implements AtExit below:
866866Test in JavaScript by running:
867867
868868 // test.js
869- var addon = require('./build/Release/addon');
869+ const addon = require('./build/Release/addon');
870870
871871[ online ] : https://v8docs.nodesource.com/
872872[ libuv ] : https://github.com/libuv/libuv
0 commit comments