diff --git a/instanceArray.js b/instanceArray.js index ab752ac..4863bef 100644 --- a/instanceArray.js +++ b/instanceArray.js @@ -15,27 +15,45 @@ var User = function(name, email, pw){ //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 + for(property of users) { + if (property.name === 'Aodhan') + console.log (property); + } + console.log('Oscar\'s information is '); //Now console.log all of Oscars information //code here - + for(property of users) { + if (property.name === 'Oscar') + console.log (property); + } + //Now create another instance of User using your own information and then add that to your users array. - //code here + users.push(new User('Robby Ann Eslava', 'robbyann.eslava@boom.camp', 'thisisapassword')); console.log('All my users names are '); //Now loop through your users Array and console.log every users name. //code here + + for(property of users) { + console.log (property.name); + } diff --git a/quizApp.js b/quizApp.js index 083bd6c..15e3603 100644 --- a/quizApp.js +++ b/quizApp.js @@ -7,26 +7,43 @@ //code here + function QuizUser (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 + function Question (title, answerArray, rightAnswer, difficulty) { + this.title = title; + this.answerArray = answerArray; + 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 ('Bruno Bruno', 'bruno@gmail.com', '12345', 10)); + quizUsers.push(new QuizUser ('Melanie Melanie', 'melanie@gmail.com', '67890', 20)); + quizUsers.push(new QuizUser ('Halsey Halsey', 'halsey@gmail.com', '98765', 30)); //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?' @@ -36,13 +53,26 @@ //code here + var quizOne = new Question('T/F: Inheritance is achieved in JavaScript through Prototypes?', '123456789', '987654321', 100); + var quizTwo = new Question('T/F: JavaScript is just a scripting version of Java', '123456789', '987654321', 100); + var quizThree = new Question('T/F: In Javascript, == does not check "type" but just the value - where === checks type and value', '123456789', '987654321', 100); //Now push all of your instances of Question into the questions Array //code here + + questions.push(quizOne); + questions.push(quizTwo); + questions.push(quizThree); 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(property of quizUsers) { + console.log(property); + } + for(property of questions) { + console.log(property); + } \ No newline at end of file diff --git a/sayName.js b/sayName.js index 6e28b51..e4d51ee 100644 --- a/sayName.js +++ b/sayName.js @@ -2,12 +2,23 @@ //code here + function Person (name, age) { + this.name = name; + this.age = age; + } //Now create three instances of Person with data you make up //code here + var Bruno = new Person('Bruno', 21); + var Melanie = new Person('Melanie', 23); + var Halsey = new Person('Halsey', 27); //Now add a sayName method on your Person class that will alert the name of whatever Person instance called it. //code here + + function sayname() { + console.log(this.name); + } \ No newline at end of file diff --git a/user.json b/user.json index 4ac80a0..5b5934d 100644 --- a/user.json +++ b/user.json @@ -1,4 +1,4 @@ { - "name": "", - "email": "" + "name": "Robby Ann Eslava", + "email": "robbyann.eslava@boom.camp" }