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
3 changes: 3 additions & 0 deletions src/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"git.ignoreLimitWarning": true
}
26 changes: 26 additions & 0 deletions src/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# JavaScript II

## Topics

* recursion
* base case
* constructors
* `new`
* `prototype`
* `.bind`, `.call`, `.apply`
* `this`
* `class`
* methods
* inheritance
* prototype methods vs methods in the constructor (Methods that inherit via the prototype chain can be changed universally for all instances)
* class vs instance

## Instructions

* Fork and clone this repo.
* Run the command `npm i` to install needed node packages.
* Run the command `npm test <filename>` to run the tests. (Example: `npm test prototype`)
* Work through the files and make the tests pass.
* Suggested order: `prototype.js`, `class.js`, `recursion.js`, `this.js`.
* When you are finished submit a pull request.
* Make commits often. A good practice would be to make a commit when you get a test, or set of tests, to pass.
34 changes: 34 additions & 0 deletions src/class.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,20 @@
// for a potential password that will be compared to the `password` property.
// Return true if the potential password matches the `password` property. Otherwise return false.

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

comparePasswords(potentialPassword) {
if (this.password === potentialPassword) {
return true;
}
return false;
}
}

// code here

// Part 2
Expand All @@ -20,6 +34,26 @@
// property set on the Cat instance.

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

growOlder() {
const olderAge = this.age + 1;
return olderAge;
}
}

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

/* eslint-disable no-undef */

Expand Down
Loading