Skip to content

Commit 9a57dd7

Browse files
committed
Updated objectives
1 parent a6b0301 commit 9a57dd7

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

labs/Shell.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ In this lab we'll put together a simple shell. We'll interact with the filesyste
1010

1111
### Objectives
1212

13-
* Filesystem
1413
* The global process variable
14+
* Filesystem operations
15+
* Working with streams
16+
* JavaScript practice
1517

1618
## Lab
1719
Commands will be provided to our shell through the process' standard in. By default, Node does not enable standard input. So the first thing we'll do is enable standard in and echo the commands.
@@ -293,11 +295,7 @@ fileStream.on('end', function () {
293295
If you're new to JavaScript you may be confused by the check to see if an element is a number. This ensures ```newLineOffsets[index]``` has been set to a number. If the value was never set it would be ```undefined```. Alternatively, this could have been:
294296

295297
```js
296-
if (typeof newLineOffsets[index] !== 'undefined') {
297-
var position = newLineOffsets[index] + 1;
298-
} else {
299-
var position = 0;
300-
}
298+
typeof newLineOffsets[index] !== 'undefined'
301299
```
302300

303301
Some examples of the ```typeof``` operator:
@@ -309,7 +307,7 @@ Some examples of the ```typeof``` operator:
309307

310308
**Important**
311309

312-
Another important detail about this example is that the variable declaration happens within the braces of the conditional statement. In other languages ```position``` would not be available out of the scope of the conditional block. However, in JavaScript, ```position``` is available outside of the statement block because of how scoping is handled in JavaScript. In short, JavaScript scope is at the ```function``` level. If you want to read more search for *variable hoisting* on Google.
310+
Another important detail about this example is that the variable declaration happens within the braces of the conditional statement. In other languages ```position``` would not be available out of the scope of the conditional block. However, in JavaScript, ```position``` is available outside of the statement block because of how scoping is handled in JavaScript. In short, JavaScript scope is at the ```function``` level. If you want to read more search for *JavaScript variable hoisting* on Google.
313311

314312

315313

0 commit comments

Comments
 (0)