From 6745a7f72fb846674c188b8aa6f686a7822c5a3e Mon Sep 17 00:00:00 2001 From: Tracy Dean Date: Fri, 21 Sep 2018 12:06:12 +1000 Subject: [PATCH 1/6] bash check --- check_week_1.js | 74 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 check_week_1.js diff --git a/check_week_1.js b/check_week_1.js new file mode 100644 index 0000000..974e9b1 --- /dev/null +++ b/check_week_1.js @@ -0,0 +1,74 @@ +// Week 1 Assessment + +// Bash (Terminal) +// Assume your present working directory is $ ~/buffy +// Make two directories inside ~/buffy: scoobies and vamps + +mkdir scoobies vamps + +// Make files in scoobies named buffy.txt, giles.txt and angel.txt + +touch scoobies/buffy.txt scoobies/giles.txt scoobies/angel.txt + +// Copy angel.txt into the vamps directory + +cp scoobies/angel.txt vamp/angel.txt + +// Delete the vamps directory and everything inside it + +rm -r vamps + +// JS Variables + +// Assign the string "Jack" to a variable called captain +var captain = 'Jack' + +// Using the captain variable, use string concatenation to form the string "Oh Jack, my Jack!", assigning it to a variable named phrase + + +// JS Conditionals + +// var souls = 3; +// var lifeRafts = 2; +// Write an if statement that console.logs "SOS!" if there are more souls than lifeRafts + +// Data Structures - JS Arrays + +// Create an array named weekend with just 'Saturday' in it + + +// Add 'Sunday' to the end of the weekend array + + +// Add 'Friday' to the front to the front of the weekend array + + +// Access 'Saturday' in the array and assign to a variable named day + + +// Remove 'Friday' from the array + + +// Data Structures - JS Objects + +// Write an object literal named brain having a property of energyLevel with a value of 10 as a number + + +// Assign the property of energyLevel to a variable named energy + + +// Add a dream property to the brain object that holds the string 'electric sheep' + + +// Add a dayDream property to the brain object that holds the object { lunch: ['burger', 'beer'] } + + +// Add another element pudding to the lunch array inside the brain object + + +// JS Functions + +// Write a function to return the area of a rectangle (the product of its length and its width) + + +// Invoke the function with 3 and 4 as arguments and save it to a variable named result \ No newline at end of file From 8c9467e0f39b5dba2d41e6045573540c3f2e472d Mon Sep 17 00:00:00 2001 From: Tracy Dean Date: Fri, 21 Sep 2018 12:14:35 +1000 Subject: [PATCH 2/6] variables check --- check_week_1.js | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/check_week_1.js b/check_week_1.js index 974e9b1..361c49f 100644 --- a/check_week_1.js +++ b/check_week_1.js @@ -1,22 +1,22 @@ // Week 1 Assessment -// Bash (Terminal) -// Assume your present working directory is $ ~/buffy -// Make two directories inside ~/buffy: scoobies and vamps +// // Bash (Terminal) +// // Assume your present working directory is $ ~/buffy +// // Make two directories inside ~/buffy: scoobies and vamps -mkdir scoobies vamps +// mkdir scoobies vamps -// Make files in scoobies named buffy.txt, giles.txt and angel.txt +// // Make files in scoobies named buffy.txt, giles.txt and angel.txt -touch scoobies/buffy.txt scoobies/giles.txt scoobies/angel.txt +// touch scoobies/buffy.txt scoobies/giles.txt scoobies/angel.txt -// Copy angel.txt into the vamps directory +// // Copy angel.txt into the vamps directory -cp scoobies/angel.txt vamp/angel.txt +// cp scoobies/angel.txt vamp/angel.txt -// Delete the vamps directory and everything inside it +// // Delete the vamps directory and everything inside it -rm -r vamps +// rm -r vamps // JS Variables @@ -25,6 +25,7 @@ var captain = 'Jack' // 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 @@ -32,6 +33,8 @@ var captain = 'Jack' // var lifeRafts = 2; // Write an if statement that console.logs "SOS!" if there are more souls than lifeRafts + + // Data Structures - JS Arrays // Create an array named weekend with just 'Saturday' in it From f0cd9f958fc7a5acf25ccc3099e2395a44143aad Mon Sep 17 00:00:00 2001 From: Tracy Dean Date: Fri, 21 Sep 2018 12:16:32 +1000 Subject: [PATCH 3/6] conditionals check --- check_week_1.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/check_week_1.js b/check_week_1.js index 361c49f..b2e2bd9 100644 --- a/check_week_1.js +++ b/check_week_1.js @@ -18,22 +18,24 @@ // rm -r vamps -// JS Variables +// // JS Variables -// Assign the string "Jack" to a variable called captain -var captain = 'Jack' +// // Assign the string "Jack" to a variable called captain +// var captain = 'Jack' -// Using the captain variable, use string concatenation to form the string "Oh Jack, my Jack!", assigning it to a variable named phrase +// // 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 + '!' +// var phrase = 'Oh ' + captain + ', my ' + captain + '!' // JS Conditionals -// var souls = 3; -// var lifeRafts = 2; +var souls = 3; +var lifeRafts = 2; // Write an if statement that console.logs "SOS!" if there are more souls than lifeRafts - +if (souls > lifeRafts) { + console.log('SOS!') +} // Data Structures - JS Arrays From 0ddcd1439168cdc7702ef1c8de3f401a99f74e56 Mon Sep 17 00:00:00 2001 From: Tracy Dean Date: Fri, 21 Sep 2018 12:22:20 +1000 Subject: [PATCH 4/6] arrays check --- check_week_1.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/check_week_1.js b/check_week_1.js index b2e2bd9..0825c86 100644 --- a/check_week_1.js +++ b/check_week_1.js @@ -27,32 +27,37 @@ // var phrase = 'Oh ' + captain + ', my ' + captain + '!' -// JS Conditionals +// // JS Conditionals -var souls = 3; -var lifeRafts = 2; -// Write an if statement that console.logs "SOS!" if there are more souls than lifeRafts +// var souls = 3; +// var lifeRafts = 2; +// // Write an if statement that console.logs "SOS!" if there are more souls than lifeRafts -if (souls > lifeRafts) { - console.log('SOS!') -} +// if (souls > lifeRafts) { +// console.log('SOS!') +// } // Data Structures - JS Arrays // Create an array named weekend with just 'Saturday' in it +var weekend = ['Saturday']; // Add 'Sunday' to the end of the weekend array +weekend.push('Sunday'); // Add 'Friday' to the front to the front of the weekend array +weekend.unshift('Friday'); // Access 'Saturday' in the array and assign to a variable named day +var day = weekend[1]; // Remove 'Friday' from the array +weekend.shift(); // Data Structures - JS Objects From 89c74c87bd5ca756dc7b3d59df22610c49c5b331 Mon Sep 17 00:00:00 2001 From: Tracy Dean Date: Fri, 21 Sep 2018 12:34:55 +1000 Subject: [PATCH 5/6] objects check --- check_week_1.js | 33 +++++++++++++++++++++------------ index.html | 14 ++++++++++++++ 2 files changed, 35 insertions(+), 12 deletions(-) create mode 100644 index.html diff --git a/check_week_1.js b/check_week_1.js index 0825c86..9dbfd36 100644 --- a/check_week_1.js +++ b/check_week_1.js @@ -37,48 +37,57 @@ // console.log('SOS!') // } -// Data Structures - JS Arrays +// // Data Structures - JS Arrays -// Create an array named weekend with just 'Saturday' in it +// // Create an array named weekend with just 'Saturday' in it -var weekend = ['Saturday']; +// var weekend = ['Saturday']; -// Add 'Sunday' to the end of the weekend array +// // Add 'Sunday' to the end of the weekend array -weekend.push('Sunday'); +// weekend.push('Sunday'); -// Add 'Friday' to the front to the front of the weekend array +// // Add 'Friday' to the front to the front of the weekend array -weekend.unshift('Friday'); +// weekend.unshift('Friday'); -// Access 'Saturday' in the array and assign to a variable named day +// // Access 'Saturday' in the array and assign to a variable named day -var day = weekend[1]; +// var day = weekend[1]; -// Remove 'Friday' from the array +// // Remove 'Friday' from the array -weekend.shift(); +// weekend.shift(); // Data Structures - JS Objects // Write an object literal named brain having a property of energyLevel with a value of 10 as a number +var brain = { + energyLevel: 10 +} // Assign the property of energyLevel to a variable named energy +var energy = brain.energyLevel; // Add a dream property to the brain object that holds the string 'electric sheep' +brain.dream = 'electric sheep' // Add a dayDream property to the brain object that holds the object { lunch: ['burger', 'beer'] } +brain.dayDream = { + lunch: ['burger', 'beer'] +} // Add another element pudding to the lunch array inside the brain object +brain.dayDream.lunch.push('pudding') // JS Functions // Write a function to return the area of a rectangle (the product of its length and its width) -// Invoke the function with 3 and 4 as arguments and save it to a variable named result \ No newline at end of file +// Invoke the function with 3 and 4 as arguments and save it to a variable named result diff --git a/index.html b/index.html new file mode 100644 index 0000000..3c31152 --- /dev/null +++ b/index.html @@ -0,0 +1,14 @@ + + + + + + + Document + + +

Nothing to see here

+ + + + \ No newline at end of file From 9a0dc754c7756d5075ea49971dab919d4e823a51 Mon Sep 17 00:00:00 2001 From: Tracy Dean Date: Fri, 21 Sep 2018 12:44:15 +1000 Subject: [PATCH 6/6] functions check --- check_week_1.js | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/check_week_1.js b/check_week_1.js index 9dbfd36..6a2692f 100644 --- a/check_week_1.js +++ b/check_week_1.js @@ -59,35 +59,40 @@ // weekend.shift(); -// Data Structures - JS Objects +// // Data Structures - JS Objects -// Write an object literal named brain having a property of energyLevel with a value of 10 as a number +// // Write an object literal named brain having a property of energyLevel with a value of 10 as a number -var brain = { - energyLevel: 10 -} +// var brain = { +// energyLevel: 10 +// } -// Assign the property of energyLevel to a variable named energy +// // Assign the property of energyLevel to a variable named energy -var energy = brain.energyLevel; +// var energy = brain.energyLevel; -// Add a dream property to the brain object that holds the string 'electric sheep' +// // Add a dream property to the brain object that holds the string 'electric sheep' -brain.dream = 'electric sheep' +// brain.dream = 'electric sheep' -// Add a dayDream property to the brain object that holds the object { lunch: ['burger', 'beer'] } +// // Add a dayDream property to the brain object that holds the object { lunch: ['burger', 'beer'] } -brain.dayDream = { - lunch: ['burger', 'beer'] -} +// brain.dayDream = { +// lunch: ['burger', 'beer'] +// } -// Add another element pudding to the lunch array inside the brain object +// // Add another element pudding to the lunch array inside the brain object -brain.dayDream.lunch.push('pudding') +// brain.dayDream.lunch.push('pudding') // JS Functions // Write a function to return the area of a rectangle (the product of its length and its width) +function area(l, w) { + return l * w; +} // Invoke the function with 3 and 4 as arguments and save it to a variable named result + +var result = area(3, 4); \ No newline at end of file