From e2c8ef636cf5b4d6b85c8126e26643e593258859 Mon Sep 17 00:00:00 2001 From: marvin banton Date: Tue, 28 May 2019 14:32:52 +0800 Subject: [PATCH 1/5] Added user.json --- user.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/user.json b/user.json index 4ac80a0..ed7c1c0 100644 --- a/user.json +++ b/user.json @@ -1,4 +1,4 @@ { - "name": "", - "email": "" + "name": "Marvin Banton", + "email": "marvin.banton@boom.camp" } From e9e002c68806701d226cf88dc2e9d18804255c4b Mon Sep 17 00:00:00 2001 From: marvin banton Date: Tue, 28 May 2019 15:07:13 +0800 Subject: [PATCH 2/5] Finished problems in instanceArray.js --- instanceArray.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/instanceArray.js b/instanceArray.js index ab752ac..58a0fec 100644 --- a/instanceArray.js +++ b/instanceArray.js @@ -14,28 +14,34 @@ var User = function(name, email, pw){ //Create an Array called 'users' that will store all our instances of User. //code here - + var users = []; //Now create and push into your users array 3 separate instances of User using the data from above in that exact order //code here + users.push(new User('Aodhan', 'aodhan@boom.camp', 'iLoveJS')); + users.push(new User('Greg', 'greg@boom.camp', 'iLovePython')); + users.push(new User('Oscar', 'oscar@boom.camp', 'iLoveSoccer')); console.log('Aodhan\'s information is '); //Console.log all of Aodhan information //code here - + console.log(users[0]); console.log('Oscar\'s information is '); //Now console.log all of Oscars information //code here - + console.log(users[2]); //Now create another instance of User using your own information and then add that to your users array. //code here - + users.push(new User('Marvin', 'marvin.banton@boom.camp', 'password123')); console.log('All my users names are '); //Now loop through your users Array and console.log every users name. //code here + users.forEach(function(name, email, pass) { + console.log(name); + }); \ No newline at end of file From e2a37fca4cdc1151047044cdede9024130d16322 Mon Sep 17 00:00:00 2001 From: marvin banton Date: Tue, 28 May 2019 15:29:44 +0800 Subject: [PATCH 3/5] Finished problems in sayName.js --- sayName.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/sayName.js b/sayName.js index 6e28b51..cd0b745 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 - + var Person = function(name, age) { + this.name = name; + this.age = age; + } //Now create three instances of Person with data you make up //code here - + var p1 = new Person('Aodhan', '27'); + var p2 = new Person('Greg', '28'); + var p3 = new Person('Oscar', '27'); //Now add a sayName method on your Person class that will alert the name of whatever Person instance called it. //code here + Person.prototype.sayName = function() { + alert(this.name); + } + \ No newline at end of file From 22a63fe12e0f38d1879d4ad54aafde1875de5600 Mon Sep 17 00:00:00 2001 From: marvin banton Date: Tue, 28 May 2019 15:48:27 +0800 Subject: [PATCH 4/5] Finished problems in arrayProperty.js --- arrayProperty.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arrayProperty.js b/arrayProperty.js index 2287a36..e187998 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() { + var splitStr = this.split(""); + var rvrsStr = splitStr.reverse(""); + return rvrsStr.join(""); + } From c000c4a9c895617fd904b1b9a681c4f18baea4d7 Mon Sep 17 00:00:00 2001 From: marvin banton Date: Tue, 28 May 2019 16:14:25 +0800 Subject: [PATCH 5/5] Finished problems in quizApp.js --- quizApp.js | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/quizApp.js b/quizApp.js index 083bd6c..22f382f 100644 --- a/quizApp.js +++ b/quizApp.js @@ -6,27 +6,39 @@ //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 = []; //Let's say three people signed up for our service, create 3 instances of User and add each to the users Array //code here - + quizUsers.push(new QuizUser('Marvin', 'marvin@gmail.com', 'password123', '100')); + quizUsers.push(new QuizUser('Noel', 'noel@gmail.com', '123', '100')); + quizUsers.push(new QuizUser('sid', 'sid@gmail.com', '123pass', '100')); //Create a questions Array which is going to hold all of our questions //code here - +var questions = []; //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?' @@ -35,14 +47,20 @@ //Fill in the rest of the required data as you see appropriate. //code here - + var question1 = "T/F: Inheritance is achieved in JavaScript through Prototypes?"; + var question2 = "T/F: JavaScript is just a scripting version of Java"; + var question3 = "T/F: In Javascript, == doesn't check 'type' but just the value - where === checks type and value"; //Now push all of your instances of Question into the questions Array //code here +questions.push(new Question(question1, 'T/F', 'F', 'Easy')); +questions.push(new Question(question2, 'T/F', 'F', 'Hard')); +questions.push(new Question(question3, 'T/F', 'F', 'Easy')); 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);