Created
May 23, 2016 21:58
-
-
Save daronwolff/4d87ce60659283137c24e85869fdf292 to your computer and use it in GitHub Desktop.
Prototype examples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Triangle() { | |
this.a; | |
this.b; | |
this.c; | |
this.setSides = function(a, b, c) { | |
this.a = a; | |
this.b = b; | |
this.c = c; | |
}; | |
this.toString = function() { | |
console.log(" A " + this.a + " B " + this.b + " C " + this.c); | |
}; | |
} | |
var t = new Triangle(); | |
t.setSides(20, 30, 44); | |
//t.toString(); | |
function Equilateral() { | |
} | |
Equilateral.prototype = new Triangle(); | |
Equilateral.prototype.setSides = function(a) { | |
this.a = a; | |
this.b = a; | |
this.c = a; | |
} | |
var eq = new Equilateral(); | |
eq.setSides(50); | |
eq.toString(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment