From 89854bbce28be9df7faa436de9129278885a992d Mon Sep 17 00:00:00 2001 From: KrishnaP Date: Mon, 11 Dec 2017 16:49:33 -0800 Subject: [PATCH 1/2] First commit --- basics.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/basics.js b/basics.js index 94aaf06..17a6970 100644 --- a/basics.js +++ b/basics.js @@ -1,22 +1,42 @@ /* Create a `myName` variable and assign it a String value */ - +var myName = "krishna"; /* 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:"krishna", +age: 23 + + }; /* Create a variable called `canDrive`, * if it should be true if your person object is at least 16 years old */ + var canDrive; + if (person.age < 16){ + canDrive = false; + } + else + canDrive = true; + /* Create a function called `greet`, * it should take a 1 parameter, `name` * and it should print "Hello, my name is {name}" */ + var greet = function (name){ + console.log("Hello, my name is " + name); + + } + greet(krishna); /* Create an array called `dataTypes` with atleast 1 of every data type; * (there are 6 different data types); */ + var dataTypes = ['chocolate milk',4, true,null, {}, undefined]; + + /* Create a `dog` object * it should have a `bark` function that makes your dog bark! From a90980d76827436bac6b5f99b004796cafce3acc Mon Sep 17 00:00:00 2001 From: KrishnaP Date: Mon, 11 Dec 2017 18:43:11 -0800 Subject: [PATCH 2/2] done --- basics.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/basics.js b/basics.js index 17a6970..329ac77 100644 --- a/basics.js +++ b/basics.js @@ -29,12 +29,12 @@ age: 23 console.log("Hello, my name is " + name); } - greet(krishna); + greet("krishna"); /* Create an array called `dataTypes` with atleast 1 of every data type; * (there are 6 different data types); */ - var dataTypes = ['chocolate milk',4, true,null, {}, undefined]; + var dataTypes = ['chocolate', 4, false, null, undefined, {}] @@ -42,3 +42,12 @@ age: 23 * 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", + +bark :function bark () { console.log("Bark!!");} + + +}; \ No newline at end of file