Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion arrayProperty.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@

//Add a reverse method to the String 'class' so that every instance of String can call reverse and reverse itself.

//code here
//code here
String.prototype.reverse = function(str){
let reversed= this.split("").reverse().join("");
return reversed;
}
15 changes: 15 additions & 0 deletions instanceArray.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,43 @@ 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
var aodhanInfo = new User('Aodhan', 'aodhan@boom.camp', 'iLoveJS')
users.push(aodhanInfo);
var gregInfo = new User('Greg', 'greg@boom.camp', 'iLovePython');
users.push(gregInfo);
var oscarInfo = new User('Oscar', 'oscar@boom.camp', 'iLoveSoccer');
users.push(oscarInfo);


console.log('Aodhan\'s information is ');
//Console.log all of Aodhan information

//code here
console.log(aodhanInfo);

console.log('Oscar\'s information is ');
//Now console.log all of Oscars information

//code here
console.log(oscarInfo);


//Now create another instance of User using your own information and then add that to your users array.

//code here
var martinInfo = new User('Martin', 'martin.raquion@boom.camp', 'iLoveMusic')
users.push(martinInfo);

console.log('All my users names are ');
//Now loop through your users Array and console.log every users name.

//code here
for(let x in users){
console.log(users[x].name);
}
31 changes: 30 additions & 1 deletion quizApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,46 @@

//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
let 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
let 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
var martin = new QuizUser('Martin', 'martin@boom.camp', 'martinquiz', 95);
var cecille = new QuizUser('Cecille','ceccile@boom.camp','cecillequiz', 96);
var carl = new QuizUser('Carl','carl@boom.camp', 'carlquiz', 97);

quizUsers.push(martin,cecille,carl);


//Create a questions Array which is going to hold all of our questions

//code here

let 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?'
Expand All @@ -35,14 +55,23 @@
//Fill in the rest of the required data as you see appropriate.

//code here

var Q1 = new Question('T/F: Inheritance is achieved in JavaScript through Prototypes?', 'T', 'T', 'easy');
var Q2 = new Question('T/F: JavaScript is just a scripting version of Java', 'F', 'F', 'easy');
var Q3 = new Question("T/F: In Javascript, == doesn't check 'type' but just the value - where === checks type and value", 'T','T','easy');

//Now push all of your instances of Question into the questions Array

//code here
questions.push(Q1,Q2,Q3);

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 x of quizUsers){
console.log(x);
}
for(let y of questions){
console.log(y);
}

12 changes: 11 additions & 1 deletion sayName.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,22 @@

//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 martin = new Person('Martin', 21);
var cecille = new Person ('Cecille', 23);
var carl = new Person('Carl', 25);

//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(name){
alert(this.name);
}
8 changes: 0 additions & 8 deletions test/spec/arrayPropertySpec.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
const isNode = new Function(`
try {
return this === global;
} catch (e) {
return false;
}
`);

if (isNode()) {
// test if file is running in a node process
const fs = require('fs');
Expand Down
8 changes: 1 addition & 7 deletions test/spec/quizAppSpec.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
const isNode = new Function(`
try {
return this === global;
} catch (e) {
return false;
}
`);


if (isNode()) {
// test if file is running in a node process
Expand Down
8 changes: 1 addition & 7 deletions test/spec/sayNameSpec.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
const isNode = new Function(`
try {
return this === global;
} catch (e) {
return false;
}
`);


if (isNode()) {
// test if file is running in a node process
Expand Down
4 changes: 2 additions & 2 deletions user.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"name": "",
"email": ""
"name": "Martin Earl Raquion",
"email": "martin.raquion@boom.camp"
}