Skip to content
Permalink
Browse files
added more detail to the lab
  • Loading branch information
aa7401 committed Oct 14, 2018
1 parent b4d6160 commit c42494f3de0b00a6ea85fd5eb2756c670a4e6e95
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
@@ -30,6 +30,7 @@ When a JavaScript program is invoked from the console, the entire invocation str
Study the `currency.js` script carefully. When we run this script we need to pass the currency we want as a _runtime parameter_ like this: `node currency GBP`.

1. If the script is invoked correctly there should be 3 indexes in the `process.argv` array. Index 0 contains the string `node`, index 1 contains the string `currency` and index 2 contains the string `GBP`.
1. You can see the `process.argv` array logged to the console.
2. If the array is shorter than 3 indexes we throw an error
3. Finally we take the third index and convert it to upper case, storing the resulting string in an immutable variable (constant).

@@ -2,7 +2,7 @@
'use strict'

const request = require('request')

console.log(process.argv)
try {
if (process.argv.length < 3) {
throw 'missing parameter'

0 comments on commit c42494f

Please sign in to comment.