Skip to content

Commit

Permalink
New link on js object and testing
Browse files Browse the repository at this point in the history
  • Loading branch information
EQuimper committed Mar 4, 2017
1 parent c74ac84 commit fd9b047
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## The Principles of Object-Oriented JavaScript


12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -539,8 +539,8 @@ If you have some resources to shared please do. I'm eager to find new stuff and
- [ ] [You Don't Know JS: this & Object Prototypes by Kyle Simpson](https://www.amazon.ca/You-Dont-Know-JS-Prototypes-ebook/dp/B00LPUIB9G/ref=sr_1_5?s=books&ie=UTF8&qid=1470005412&sr=1-5&keywords=kyle+simpson)
- [ ] [You Don't Know JS: ES6 & Beyond by Kyle Simpson](https://www.amazon.ca/You-Dont-Know-JS-Beyond/dp/1491904240/ref=sr_1_6?s=books&ie=UTF8&qid=1470005412&sr=1-6&keywords=kyle+simpson)
- [ ] [Single Page Web Applications: JavaScript end-to-end by Michael Mikowski](https://www.amazon.ca/Single-Page-Applications-end---end/dp/1617290750/ref=sr_1_1?ie=UTF8&qid=1473297259&sr=8-1&keywords=single+page+web+applications)
- [ ] [Serverless Single Page Apps
Fast, Scalable, and Available](https://pragprog.com/book/brapps/serverless-single-page-apps)
- [ ] [Serverless Single Page Apps Fast, Scalable, and Available](https://pragprog.com/book/brapps/serverless-single-page-apps)
- [ ] [The principles of object-oriented javascript](https://www.amazon.ca/Principles-Object-Oriented-JavaScript-Nicholas-Zakas/dp/1593275404)

- Webpack

Expand Down Expand Up @@ -768,10 +768,13 @@ Fast, Scalable, and Available](https://pragprog.com/book/brapps/serverless-singl
- [x] [The Fundamentals of Flow in 10-ish Minutes](https://www.youtube.com/watch?v=xWMuAUbXcdQ&t=19s)
- [x] [Netflix JavaScript Talks - React & Flow](https://www.youtube.com/watch?v=dV8K6fsjDCQ)
- [x] [Use ES6 style Promises with Node.js](https://egghead.io/lessons/node-js-use-es6-style-promises-with-node-js)
- [ ] [Let's Learn ES6 - Classes](https://www.youtube.com/watch?v=EUtZRwA7Fqc)
- [x] [Let's Learn ES6 - Classes](https://www.youtube.com/watch?v=EUtZRwA7Fqc)
- [ ] [Sara Raasch: Javascript Testing - Unit tests, TDD, BDD, IDK.](https://www.youtube.com/watch?v=Fjc_cwPDbNY)
- [ ] [Advanced Async and Concurrency Patterns in JavaScript](https://www.youtube.com/watch?v=Qg1SvpIau6U)
- [ ] [JavaScript ES6 / ES2015 - [04] Classes and Inheritance](https://www.youtube.com/watch?v=RBLIm5LMrmc)
- [x] [JavaScript ES6 / ES2015 Classes and Inheritance](https://www.youtube.com/watch?v=RBLIm5LMrmc)
- [x] [JavaScript object creation patterns tutorial - factory , constructor pattern, prototype pattern](https://www.youtube.com/watch?v=xizFJHKHdHw)
- [x] [JavaScript Testing Basics](https://www.youtube.com/watch?v=yrGkDeBHqvY)
- [ ] [Testing Client/Server JavaScript](https://www.youtube.com/watch?v=lLqCXLYCqTI)

- PWA

Expand Down Expand Up @@ -865,6 +868,7 @@ Fast, Scalable, and Available](https://pragprog.com/book/brapps/serverless-singl
- [x] [Setup environment variables with Node.js + Dotenv Tutorial](https://www.youtube.com/watch?v=zDup0I2VGmk)
- [x] [Build a Reddit API Clone with Node.js, Express and MongoDB - Part 1](https://www.youtube.com/watch?v=L5Nle1VXYnw)
- [x] [Build a Reddit API Clone with Node.js, Express and MongoDB - Part 2](https://youtu.be/gtMZ-WiSrs8)
- [x] [Integration Testing with Express](https://www.youtube.com/watch?v=r8sPUw4uxAI)

- Next.JS

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/**
* Factory Pattern
*/
const peopleFactory = function(name, age, location) {
const temp = {};

temp.name = name;
temp.age = age;
temp.location = location;

temp.printPeople = function() {
return console.log(`Hello ${this.name}, ${this.age} who came from ${this.location}`);
}

return temp;
}

const me = peopleFactory('Bob', 20, 'Canada');

me.printPeople()

/**
* Constructor Patter
*/
const personConstructor = function(name, age, location) {
this.name = name;
this.age = age;
this.location = location;

this.printPerson = function() {
return console.log`Hello ${this.name}, ${this.age} who came from ${this.location}`;
}
}

const you = new personConstructor('Luc', 25, 'USA');

/**
* Prototype Pattern
*/
const peopleProto = function(){};

peopleProto.prototype.name = 'no name';
peopleProto.prototype.age = 0;
peopleProto.prototype.city = 'no city';
peopleProto.prototype.print = function() {
return console.log(`Hello ${this.name}, ${this.age} who came from ${this.city}`);
}

const people1 = new peopleProto();

people1.name = 'Yan';
people1.age = 30;
people1.city = 'Quebec';

console.log(people1);

console.log('name' in people1); // true

/**
* Dynamic Proto
*/
const peopleDynamicProto = function(name, age, city) {
this.name = name;
this.age = age;
this.city = city;

if (typeof this.printPeople !== 'function') {
peopleDynamicProto.prototype.print = function() {
return console.log(`Hello ${this.name}, ${this.age} who came from ${this.city}`);
};
}
}

0 comments on commit fd9b047

Please sign in to comment.