jeandremelaria
3/28/2018 - 2:41 PM

Js - Object-oriented Programming

Object-oriented Programming in javascript

https://www.youtube.com/watch?v=rlLuL3jYLvA

function Person(fullName, favColor) {
	this.name = fullName;
	this.favoriteColor = favColor;
	this.greet = function (){
		console.log('Hello, my name is '+ this.name + ' and my favorite color is ' + this.favoriteColor '.');
	}
}

var john = new Person('John Doe', 'blue');
john.greet();

var jane = new Person('Jane Smith', 'green');
jane.greet();