You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/node.1
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -397,6 +397,7 @@ The contents of foo\.js:
397
397
.RS4
398
398
.nf
399
399
var circle = require("circle\.js");
400
+
include("/utils\.js");
400
401
puts("The area of a circle of radius 4 is " + circle\.area(4));
401
402
.fi
402
403
.RE
@@ -416,7 +417,7 @@ exports\.circumference = function (r) {
416
417
};
417
418
.fi
418
419
.RE
419
-
The module circle\.js has exported the functions area() and circumference()\. To export an object, add to the special exports object\. (Alternatively, one can use this instead of exports\.) Variables local to the module will be private\. In this example the variable PI is private to circle\.js\.
420
+
The module circle\.js has exported the functions area() and circumference()\. To export an object, add to the special exports object\. (Alternatively, one can use this instead of exports\.) Variables local to the module will be private\. In this example the variable PI is private to circle\.js\. The function puts() comes from the module "/utils\.js"\. Because include("/utils\.js") was called, puts() is in the global namespace\.
420
421
.sp
421
422
The module path is relative to the file calling require()\. That is, circle\.js must be in the same directory as foo\.js for require() to find it\.
422
423
.sp
@@ -426,6 +427,7 @@ Like require() the function include() also loads a module\. Instead of returning
426
427
.RS4
427
428
.nf
428
429
include("circle\.js");
430
+
include("/utils\.js");
429
431
puts("The area of a cirlce of radius 4 is " + area(4));
0 commit comments