From acd7b37249509224db43d5b6335b490df5eb8561 Mon Sep 17 00:00:00 2001 From: Karen Kuek Date: Fri, 21 Sep 2018 12:14:26 +1000 Subject: [PATCH 1/6] bash (terminal) completed --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index c8d2d5c..1237b16 100644 --- a/README.md +++ b/README.md @@ -7,14 +7,28 @@ 1. Make two directories inside `~/buffy`: `scoobies` and `vamps`


+## Answer +mkdir scoobies +mkdir vamps + 2. Make files in `scoobies` named `buffy.txt`, `giles.txt` and `angel.txt`


+## Answer +cd scoobies +touch buffy.txt +touch giles.txt +touch angel.txt + 3. Copy `angel.txt` into the `vamps` directory

+## Answer +cp /angel.txt ./vamps 4. Delete the `vamps` directory and everything inside it

+## Answer +rm /vamps ### JS Variables From b1fafd07ff43f922b095714aa5caa73c9c00f0a8 Mon Sep 17 00:00:00 2001 From: Karen Kuek Date: Fri, 21 Sep 2018 12:23:32 +1000 Subject: [PATCH 2/6] JS variables completed --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1237b16..9ee8c68 100644 --- a/README.md +++ b/README.md @@ -34,10 +34,12 @@ rm /vamps 1. Assign the string "Jack" to a variable called `captain`

+## Answer +var captain = 'Jack'; 2. Using the `captain` variable, use string concatenation to form the string "Oh Jack, my Jack!", assigning it to a variable named `phrase`

- +var phrase = '"Oh ' + captain + ',' + ' my ' + captain + '!"'; ### JS Conditionals ```js From 54316c8a2daf42c510f1a478a1f781c2767cb4a0 Mon Sep 17 00:00:00 2001 From: Karen Kuek Date: Fri, 21 Sep 2018 12:30:24 +1000 Subject: [PATCH 3/6] JS conditionals completed --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9ee8c68..2b06146 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,13 @@ var lifeRafts = 2; 1. Write an `if` statement that console.logs "SOS!" if there are more _souls_ than _lifeRafts_

- +## Answer +if (souls > lifeRafts) { + var say = "okay"; +} else { + var say = "SOS!" +} +console.log(say); ### Data Structures - JS Arrays From 9e8e0eb61f7c95c1842b8f1dc243d1e2416182bb Mon Sep 17 00:00:00 2001 From: Karen Kuek Date: Fri, 21 Sep 2018 12:40:30 +1000 Subject: [PATCH 4/6] JS arrays completed --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 2b06146..178cfd6 100644 --- a/README.md +++ b/README.md @@ -61,18 +61,24 @@ console.log(say); 1. Create an array named `weekend` with just 'Saturday' in it

+## Answer +var weekend = ['Saturday']; 2. Add 'Sunday' to the end of the `weekend` array

+weekend.push('Sunday'); 3. Add 'Friday' to the front to the front of the `weekend` array

+weekend.unshift('Friday'); 4. Access 'Saturday' in the array and assign to a variable named `day`

+var day = weekend[1]; 5. Remove 'Friday' from the array

+weekend.shift() ### Data Structures - JS Objects From 0f573d3dc163b924957bafeee9de986dd2fc1010 Mon Sep 17 00:00:00 2001 From: Karen Kuek Date: Fri, 21 Sep 2018 12:53:49 +1000 Subject: [PATCH 5/6] JS Objects completed --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 178cfd6..b2708d1 100644 --- a/README.md +++ b/README.md @@ -84,18 +84,25 @@ weekend.shift() 1. Write an object literal named `brain` having a property of `energyLevel` with a value of `10` as a number

+var brain = { + energyLevel: 10; +} 2. Assign the property of `energyLevel` to a variable named `energy`

+var energy = brain.energyLevel 3. Add a `dream` property to the `brain` object that holds the string 'electric sheep'

+brain.dream = 'electric sheep'; 4. Add a `dayDream` property to the `brain` object that holds the object `{ lunch: ['burger', 'beer'] }`

+brain.dayDream = { lunch: ['burger', 'beer'] }; 5. Add another element `pudding` to the lunch array inside the `brain` object

+dayDream.lunch = 'pudding'; ### JS Functions From 19ff0b19508974f540e24ae3206808c53d2e394a Mon Sep 17 00:00:00 2001 From: Karen Kuek Date: Fri, 21 Sep 2018 15:45:05 +1000 Subject: [PATCH 6/6] all completed --- README.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b2708d1..26e69b8 100644 --- a/README.md +++ b/README.md @@ -109,5 +109,17 @@ dayDream.lunch = 'pudding'; 1. Write a function to return the area of a rectangle (the product of its length and its width)

+var area = function (length, width) { + return length * width; +} +var perimeter = function (length, width) { + return 2 * (length + width); +} +console.log(area + perimeter); + 2. Invoke the function with `3` and `4` as arguments and save it to a variable named `result` -

\ No newline at end of file +

+ +var result = function (3, 4) { + +} \ No newline at end of file