From ad483cc197b24c82e78188b378eabd0acda07a4a Mon Sep 17 00:00:00 2001 From: Scott Joseph-Smith Date: Mon, 5 Mar 2018 19:47:19 -1000 Subject: [PATCH 1/2] Update basics.js --- basics.js | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/basics.js b/basics.js index 94aaf06..2962dba 100644 --- a/basics.js +++ b/basics.js @@ -1,24 +1,51 @@ /* Create a `myName` variable and assign it a String value */ +var myName = 'Scott' + /* Create a `person` variable and give it 2 properties, * `name`, assign it the same name as before, * as well as an `age` (number); */ +var person = { + [name: 'Scott'], + [age: 37] +} + /* Create a variable called `canDrive`, * if it should be true if your person object is at least 16 years old */ +var canDrive = false; +function license (){ + if person.age >= 16 { + canDrive === true; + } else { + canDrive === false; + } +} + /* Create a function called `greet`, * it should take a 1 parameter, `name` * and it should print "Hello, my name is {name}" */ - +function greet (){ + document.write('Hello, my name is ' + person.name); +} /* Create an array called `dataTypes` with atleast 1 of every data type; * (there are 6 different data types); */ - +var dataTypes = ['one', 1, true, null, undefined, Symbol()] /* Create a `dog` object * it should have a `bark` function that makes your dog bark! * It should also have a name attribute with the value of 'Spot' */ + + var dog = { + [name: 'Spot']; + function bark () { + if (dog.name === 'Spot') { + alert('bark') + } + } + } From 53945f806fa027453291cc8b0337ffc7ffa41721 Mon Sep 17 00:00:00 2001 From: Scott Joseph-Smith Date: Fri, 9 Mar 2018 13:32:23 -1000 Subject: [PATCH 2/2] Update basics.js --- basics.js | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/basics.js b/basics.js index 2962dba..21ec673 100644 --- a/basics.js +++ b/basics.js @@ -1,5 +1,4 @@ /* Create a `myName` variable and assign it a String value */ - var myName = 'Scott' /* Create a `person` variable and give it 2 properties, @@ -8,44 +7,38 @@ var myName = 'Scott' */ var person = { - [name: 'Scott'], - [age: 37] + name: 'Scott', + age: 37 } /* Create a variable called `canDrive`, * if it should be true if your person object is at least 16 years old */ -var canDrive = false; -function license (){ - if person.age >= 16 { - canDrive === true; - } else { - canDrive === false; - } -} +var canDrive = person.age >=16; /* Create a function called `greet`, * it should take a 1 parameter, `name` * and it should print "Hello, my name is {name}" */ -function greet (){ - document.write('Hello, my name is ' + person.name); + +function greet (name) { + console.log('Hello, my name is ' + name); } +greet('Scott'); /* Create an array called `dataTypes` with atleast 1 of every data type; * (there are 6 different data types); */ -var dataTypes = ['one', 1, true, null, undefined, Symbol()] + +var dataTypes = [1, 'two', true, null, undefined, {}]; + /* Create a `dog` object * it should have a `bark` function that makes your dog bark! * It should also have a name attribute with the value of 'Spot' */ - var dog = { - [name: 'Spot']; - function bark () { - if (dog.name === 'Spot') { - alert('bark') - } + name: 'Spot', + bark: function () { + console.log('bark'); } - } + };