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: labs/REPL.md
+8-7Lines changed: 8 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -128,7 +128,8 @@ Properties using the array syntax:
128
128
3
129
129
```
130
130
131
-
Objects are compositional:
131
+
Objects can be composed of other objects:
132
+
132
133
133
134
```JavaScript
134
135
>o.bar= [1, 2, 3, 4]
@@ -145,13 +146,13 @@ Objects are compositional:
145
146
146
147
## Functions
147
148
148
-
JavaScript functions are declared using the ```function``` keyword.
149
+
1.JavaScript functions are declared using the ```function``` keyword.
149
150
150
151
```JavaScript
151
152
varFoo=function () { }
152
153
```
153
154
154
-
Functions that do not have a name are *Anonymous Functions*. These are commonly used as callback arguments to other functions.
155
+
1.Functions that do not have a name are *Anonymous Functions*. These are commonly used as callback arguments to other functions.
155
156
156
157
```JavaScript
157
158
//Anonymous function declaration
@@ -171,14 +172,14 @@ Foo(function () {
171
172
172
173
## Multi-line statements
173
174
174
-
The Node REPL allows for multi-line statements to be executed. When a line cannot be processed as a complete JavaScript statement the Node REPL prompts for more input:
175
+
1.The Node REPL allows for multi-line statements to be executed. When a line cannot be processed as a complete JavaScript statement the Node REPL prompts for more input (this example starts a functional closure but does not terminate it with a closing bracket):
175
176
176
177
```
177
178
> var boo = function () {
178
179
...
179
180
```
180
181
181
-
The ```...``` indicates that the Node REPL expects more input. ```CTRL+C``` can be used to terminate the multi-line statement. Now, define a multi-line function and execute it:
182
+
1.The ```...``` indicates that the Node REPL expects more input. ```CTRL+C``` can be used to terminate the multi-line statement. Now, define a multi-line function and execute it:
182
183
183
184
```JavaScript
184
185
>varboo=function () {
@@ -189,11 +190,11 @@ undefined
189
190
'Hello World!'
190
191
```
191
192
192
-
## Exiting
193
+
## Exiting the REPL
193
194
194
195
Exiting the Node REPL can be done many ways including killing the process. However, the most common way is by pressing ```CTRL+C``` twice.
0 commit comments