Created
November 3, 2015 12:37
-
-
Save xthecapx/7fa5378364dcf57e3068 to your computer and use it in GitHub Desktop.
Create and using constructor
This file contains 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 Fencepost(x, y, postNum) { //Constructor | |
this.x = x; | |
this.y = y; | |
this.postNum = postNum; | |
this.connectionsTo = []; | |
this.sendRopeTo = function(connectedPost) { | |
this.connectionsTo.push(connectedPost); | |
}; | |
} | |
// Using constructor | |
var post = new Fencepost(-3, 4, 1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment