Skip to content

Instantly share code, notes, and snippets.

@ericpkatz
Created June 10, 2015 23:37
Show Gist options
  • Select an option

  • Save ericpkatz/58b8a1d85a5fe3ac3d94 to your computer and use it in GitHub Desktop.

Select an option

Save ericpkatz/58b8a1d85a5fe3ac3d94 to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/sifuvu
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
console.clear();
function Person(config){
this.firstName = config.firstName;
this.lastName = config.lastName;
this.middleInitial = config.middleInitial;
}
Person.prototype = {
fullName: function(){
return this.firstName + " " + this.middleInitial + ". " + this.lastName;
},
sayHi: function(){
console.log("Hello my name is " + this.fullName());
}
};
var prof = new Person({
firstName: "Eric",
lastName: "Katz",
middleInitial: "P"
});
prof.sayHi();
var owen = new Person({
firstName: "Owen",
lastName: "Katz",
middleInitial:"A"
});
owen.sayHi();
console.log(owen.fullName == prof.fullName);
</script>
<script id="jsbin-source-javascript" type="text/javascript">console.clear();
function Person(config){
this.firstName = config.firstName;
this.lastName = config.lastName;
this.middleInitial = config.middleInitial;
}
Person.prototype = {
fullName: function(){
return this.firstName + " " + this.middleInitial + ". " + this.lastName;
},
sayHi: function(){
console.log("Hello my name is " + this.fullName());
}
};
var prof = new Person({
firstName: "Eric",
lastName: "Katz",
middleInitial: "P"
});
prof.sayHi();
var owen = new Person({
firstName: "Owen",
lastName: "Katz",
middleInitial:"A"
});
owen.sayHi();
console.log(owen.fullName == prof.fullName);</script></body>
</html>
console.clear();
function Person(config){
this.firstName = config.firstName;
this.lastName = config.lastName;
this.middleInitial = config.middleInitial;
}
Person.prototype = {
fullName: function(){
return this.firstName + " " + this.middleInitial + ". " + this.lastName;
},
sayHi: function(){
console.log("Hello my name is " + this.fullName());
}
};
var prof = new Person({
firstName: "Eric",
lastName: "Katz",
middleInitial: "P"
});
prof.sayHi();
var owen = new Person({
firstName: "Owen",
lastName: "Katz",
middleInitial:"A"
});
owen.sayHi();
console.log(owen.fullName == prof.fullName);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment