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
165 changes: 148 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"repository": {
"type": "git",
"url": "git+https://github.com/LambdaSchool/javascript-ii.git"
},
},
"devDependencies": {
"babel-jest": "^19.0.0",
"eslint": "^3.17.1",
Expand Down
45 changes: 44 additions & 1 deletion src/class.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@

// code here

class User {
constructor(options) {
this.email = options.email;
this.password = options.password;
}
comparePasswords(password) {
return (this.password === password);
}
}

// Part 2
// Create a class called `Animal` and a class called `Cat` using ES6 classes.
// `Cat` should extend the `Animal` class.
Expand All @@ -19,7 +29,40 @@
// `meow` that should return the string `<name> meowed!` where `<name>` is the `name`
// property set on the Cat instance.

// code here
class Animal {
constructor(options) {
this.age = options.age;
}
growOlder() {
return ++this.age;
}
}

class Cat extends Animal {
constructor(options) {
super(options);
this.name = options.name;
}
meow() {
return `${this.name} meowed!`;
}
}

// function Animal (object) { //constructor function
// this.type = object.type;
// this.name = object.name;
// this.sound = object.sound;
// this.speak = function() {
// return this.sound;
// };
// }

// const doggo = new Animal({type: 'Dog', name: 'Murphy', sound: 'Woof'});
// console.log(doggo);
// console.log(doggo.name);
// console.log(doggo.speak());
// const liger = new Animal({type: 'Liger', name: 'Leroy', sound: 'Nyeeoow'});
// console.log(liger);

/* eslint-disable no-undef */

Expand Down
Loading