From 5fe554845c726861cd8112d17fd49af369208ecd Mon Sep 17 00:00:00 2001 From: Rex Rojo Date: Tue, 28 May 2019 05:26:08 -0400 Subject: [PATCH 1/5] Finished user.json --- user.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/user.json b/user.json index 4ac80a0..1fb1116 100644 --- a/user.json +++ b/user.json @@ -1,4 +1,4 @@ { - "name": "", - "email": "" + "name": "Rex Rojo", + "email": "rex.rojo@boom.camp" } From e5f88178ed0a5e3072bca9212b337bc834264f0a Mon Sep 17 00:00:00 2001 From: Rex Rojo Date: Tue, 28 May 2019 05:26:47 -0400 Subject: [PATCH 2/5] finished arrayProperty.js --- arrayProperty.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arrayProperty.js b/arrayProperty.js index 2287a36..70166d9 100644 --- a/arrayProperty.js +++ b/arrayProperty.js @@ -2,4 +2,9 @@ //Add a reverse method to the String 'class' so that every instance of String can call reverse and reverse itself. - //code here \ No newline at end of file + //code here + + String.prototype.reverse=function(){ + return this.split("").reverse().join(""); + } + From cda59492148eaf39512c5023055406d157e62958 Mon Sep 17 00:00:00 2001 From: Rex Rojo Date: Tue, 28 May 2019 05:27:41 -0400 Subject: [PATCH 3/5] Finished instanceArray.js --- instanceArray.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/instanceArray.js b/instanceArray.js index ab752ac..5706aaa 100644 --- a/instanceArray.js +++ b/instanceArray.js @@ -14,28 +14,41 @@ var User = function(name, email, pw){ //Create an Array called 'users' that will store all our instances of User. //code here - +var users= new Array(); //Now create and push into your users array 3 separate instances of User using the data from above in that exact order //code here +var Aodhan= new Array('Aodhan','aodhan@boom.camp','iLoveJS'); +users.push(Aodhan); +var Greg=new Array('Greg','greg@boom.camp','iLovePython'); +users.push(Greg); +var Oscar=new Array('Oscar','oscar@boom.camp','iLoveSoccer'); +users.push(Oscar); + + + console.log('Aodhan\'s information is '); //Console.log all of Aodhan information //code here +console.log(Aodhan); console.log('Oscar\'s information is '); //Now console.log all of Oscars information //code here + console.log(Oscar); //Now create another instance of User using your own information and then add that to your users array. //code here - +var Rex=new Array('Rex','rex.rojo@boom.camp','ILY'); +users.push(Rex) console.log('All my users names are '); //Now loop through your users Array and console.log every users name. //code here +console.log(users); \ No newline at end of file From b04df00c89f76b8eaecbb07f6517698f14e98216 Mon Sep 17 00:00:00 2001 From: Rex Rojo Date: Tue, 28 May 2019 05:28:18 -0400 Subject: [PATCH 4/5] finished sayname.js --- sayName.js | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/sayName.js b/sayName.js index 6e28b51..b16160a 100644 --- a/sayName.js +++ b/sayName.js @@ -1,13 +1,22 @@ //Create a Person constructor that accepts name and age as parameters and sets those properties accordingly in the Constructor. //code here - - -//Now create three instances of Person with data you make up - - //code here - - -//Now add a sayName method on your Person class that will alert the name of whatever Person instance called it. - - //code here + var Person=function(name,age){ + this.name=name; + this.age=age; + this.sayName=function(){ + alert (this.name); + } + } + + //Now create three instances of Person with data you make up + + //code here + var rex= new Person('Rex',22); + var tor= new Person('Tor',25); + var noun=new Person('Noun',23); + + //Now add a sayName method on your Person class that will alert the name of whatever Person instance called it. + + //code here + rex.sayName(); \ No newline at end of file From 1c77237703998834806eb3be61e2717466205031 Mon Sep 17 00:00:00 2001 From: Rex Rojo Date: Tue, 28 May 2019 05:28:58 -0400 Subject: [PATCH 5/5] finished quizApp.js --- quizApp.js | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/quizApp.js b/quizApp.js index 083bd6c..9541919 100644 --- a/quizApp.js +++ b/quizApp.js @@ -6,27 +6,41 @@ //Create a QuizUser constructor that accepts name, email, password, and totalScore parameters and set them appropriatly //code here - +var QuizUser=function(name,email,password,totalScore){ + this.name=name; + this.email=email; + this.password=password; + this.totalScore=totalScore; +} //Create a Question constructor that accepts title, answersArray, rightAnswer, and difficulty parameters //code here - +var Question=function(title,answersArray,rightAnswer,difficulty){ + this.title=title; + this.answersArray=answersArray; + this.rightAnswer=rightAnswer; + this.difficulty=difficulty; +} //Create a quizUsers Array which is going to hold all of our users. //code here - +var quizUsers= new Array; //Let's say three people signed up for our service, create 3 instances of User and add each to the users Array //code here - - +var rex=new Array('Rex','rex.rojo@boom.camp','qwerty','90'); +quizUsers.push(rex); +var keanu=new Array('Keanu','Keanu.manly@boom.camp','dsdgad','80'); +quizUsers.push(keanu); +var greg=new Array('Greg','greg@boom.camp','hfsasfhasjdf','100'); +quizUsers.push(greg); //Create a questions Array which is going to hold all of our questions //code here - +var questions= new Array; //Now, let's say we wanted to create a quiz about JavaScript. Create three instances of Question which contain the following data //title: 'T/F: Inheritance is achieved in JavaScript through Prototypes?' @@ -36,13 +50,19 @@ //code here + var quiz1=new Array('inheritance','inheritance is achieved in JavaScript','True','Easy'); + var quiz2=new Array('JavaScript','JavaScript is just a scripting version of Java','False','Normal'); + var quiz3=new Array('check','In Javascript, == doesnt check type but just the value - where === checks type and value','false',"Hard"); //Now push all of your instances of Question into the questions Array //code here - +questions.push(quiz1); +questions.push(quiz2); +questions.push(quiz3); console.log('My users Array and my questions arrray are ...'); //Now loop console.log your users array and your questions array and verify that they're both holding the right data. //code here - +console.log(quizUsers); +console.log(questions); \ No newline at end of file