Created
July 30, 2015 18:07
-
-
Save goldhand/ee579399ad2b4c973f16 to your computer and use it in GitHub Desktop.
Intro to Javascript prototypes
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 Car() {} | |
var myCar = new Car; | |
Car.prototype.tickets = 0; | |
Car.prototype.incrementTickets = function() { | |
this.tickets++; | |
return this.tickets; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment