@@ -624,6 +624,7 @@ $ node args.js one two three
624
624
The first 2 arguments aren't too useful, just ` node ` and the
625
625
full path to our script, but the remaining arguments are
626
626
everything that follows ` args.js ` on the command-line.
627
+
627
628
---
628
629
To get only the useful arguments, we can use ` .slice(2) ` :
629
630
@@ -658,6 +659,7 @@ $ node add.js 3 5
658
659
Note that every element in ` process.argv ` is a string, so we
659
660
can use the built-in ` Number ` function to convert from a
660
661
string to a number.
662
+
661
663
---
662
664
# objects
663
665
@@ -667,6 +669,7 @@ We've already been using some objects:
667
669
` argv ` that is an array.
668
670
* ` console ` is an object with a property
669
671
` log ` that is a function.
672
+
670
673
---
671
674
# objects
672
675
@@ -1055,6 +1058,7 @@ console.log(add(5, 2)); // 7
1055
1058
1056
1059
When you declare functions in expressions you don't need to
1057
1060
give them a name.
1061
+
1058
1062
---
1059
1063
# immediately executing function
1060
1064
@@ -1073,6 +1077,7 @@ console.log(sum); // 12
1073
1077
Variables declared inside functions are only visible in that
1074
1078
function, so immediately executing functions are sometimes
1075
1079
used to create an isolated scope.
1080
+
1076
1081
---
1077
1082
You could even do:
1078
1083
@@ -1240,6 +1245,7 @@ console.log(n.multiply(3)); // 315
1240
1245
1241
1246
` n` is an "instance" of Num. You can make as many instances
1242
1247
as you like and they will all have separate values.
1248
+
1243
1249
---
1244
1250
# constructors: new trick
1245
1251
@@ -1414,6 +1420,7 @@ Your entirely optional homework is to get through the
1414
1420
` javascripting` lesson on nodeschool:
1415
1421
1416
1422
http://nodeschool.io/#javascripting
1423
+
1417
1424
---
1418
1425
# links
1419
1426
0 commit comments