From 900d3e60844a861388762bf5ee34d0d2c2b20b3c Mon Sep 17 00:00:00 2001 From: Jules Date: Tue, 28 May 2019 13:50:04 +0800 Subject: [PATCH 1/5] add details --- user.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/user.json b/user.json index 4ac80a0..3d7a607 100644 --- a/user.json +++ b/user.json @@ -1,4 +1,4 @@ { - "name": "", - "email": "" + "name": "Jules Ballaran", + "email": "jules.ballaran@boom.camp" } From d4b52e7725724acf2c215b056467fced404e70d9 Mon Sep 17 00:00:00 2001 From: Jules Date: Tue, 28 May 2019 14:07:25 +0800 Subject: [PATCH 2/5] instanceArray done --- instanceArray.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/instanceArray.js b/instanceArray.js index ab752ac..d6a1092 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[0] = new User('Aodhan', 'aodhan@boom.camp', 'iLoveJS'); +users[1] = new User('Greg', 'greg@boom.camp', 'iLovePython'); +users[2] = 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].name, users[0].email, users[0].pw); console.log('Oscar\'s information is '); //Now console.log all of Oscars information //code here - +console.log(users[2].name, users[2].email, users[2].pw); //Now create another instance of User using your own information and then add that to your users array. //code here - +users[3] = new User('Jules', 'jules.ballaran@boom.camp', 'asd'); console.log('All my users names are '); //Now loop through your users Array and console.log every users name. //code here +for(let i=0; i Date: Tue, 28 May 2019 15:14:06 +0800 Subject: [PATCH 3/5] sayName done --- sayName.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sayName.js b/sayName.js index 6e28b51..d9f9287 100644 --- a/sayName.js +++ b/sayName.js @@ -1,12 +1,20 @@ //Create a Person constructor that accepts name and age as parameters and sets those properties accordingly in the Constructor. //code here - +class Person{ + constructor(name, age){ + this.name = name; + this.age = age; + } + sayName(){ + alert(this.name); + } +} //Now create three instances of Person with data you make up //code here - +var john = new Person('John', 54); //Now add a sayName method on your Person class that will alert the name of whatever Person instance called it. From b8e9df0b64570f83869752d5de9d59a3d0534cff Mon Sep 17 00:00:00 2001 From: Jules Date: Tue, 28 May 2019 16:06:01 +0800 Subject: [PATCH 4/5] arrayProperty done --- arrayProperty.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/arrayProperty.js b/arrayProperty.js index 2287a36..9bc6de3 100644 --- a/arrayProperty.js +++ b/arrayProperty.js @@ -2,4 +2,12 @@ //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 (str){ + str = this; + return str.split("").reverse().join(""); +} + +var str = 'Jules'; +console.log(str.reverse()); From b88426dfd71f581f5db2fd125dfee0df23302603 Mon Sep 17 00:00:00 2001 From: Jules Date: Tue, 28 May 2019 16:23:41 +0800 Subject: [PATCH 5/5] quizApp done --- quizApp.js | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/quizApp.js b/quizApp.js index 083bd6c..ec24225 100644 --- a/quizApp.js +++ b/quizApp.js @@ -6,27 +6,43 @@ //Create a QuizUser constructor that accepts name, email, password, and totalScore parameters and set them appropriatly //code here - +class QuizUser{ + constructor(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 - +class Question{ + constructor(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[0] = new QuizUser('jomar', 'jomar@gmail.com', '123213', 50); + quizUsers[1] = new QuizUser('jomar', 'jomar@gmail.com', '123213', 5011); + quizUsers[2] = new QuizUser('jomar', 'jomar@gmail.com', '123213', 501); //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,8 +51,9 @@ //Fill in the rest of the required data as you see appropriate. //code here - - +questions.push(new Question('T/F: Inheritance is achieved in JavaScript through Prototypes?', ['T', 'F'], 'F', 1)); +questions.push(new Question('T/F: JavaScript is just a scripting version of Java', ['T', 'F'], 'T', 1)); +questions.push(new Question("T/F: In Javascript, == doesn't check 'type' but just the value - where === checks type and value", ['T', 'F'], 'T', 1)); //Now push all of your instances of Question into the questions Array //code here @@ -45,4 +62,6 @@ 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 - +for(let i=0; i