From c42494f3de0b00a6ea85fd5eb2756c670a4e6e95 Mon Sep 17 00:00:00 2001 From: Mark Tyers Date: Sun, 14 Oct 2018 19:37:42 +0100 Subject: [PATCH] added more detail to the lab --- 01 Lab 3 Async Code.md | 1 + exercises/01_nodejs/03_async/currency.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/01 Lab 3 Async Code.md b/01 Lab 3 Async Code.md index ec72c26..acf7fc8 100644 --- a/01 Lab 3 Async Code.md +++ b/01 Lab 3 Async Code.md @@ -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). diff --git a/exercises/01_nodejs/03_async/currency.js b/exercises/01_nodejs/03_async/currency.js index b9e08c2..4f4e224 100644 --- a/exercises/01_nodejs/03_async/currency.js +++ b/exercises/01_nodejs/03_async/currency.js @@ -2,7 +2,7 @@ 'use strict' const request = require('request') - +console.log(process.argv) try { if (process.argv.length < 3) { throw 'missing parameter'