Created
September 21, 2013 18:31
-
-
Save stevencombs/6652976 to your computer and use it in GitHub Desktop.
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
// Javascript Getting Started with Programming | |
// A Codecademy Javascript (Make Your Own Method) assignment | |
// Dr. Steven B. Combs, coding novice | |
var rectangle = new Object(); // New object 'rectangle' | |
rectangle.height = 3; // Rectangle height 3 | |
rectangle.width = 4; // Rectangle width 4 | |
rectangle.setHeight = function (newHeight) { // Set rectangle height function | |
this.height = newHeight; // Use 'this' as placeholder to modify object called | |
}; | |
rectangle.setWidth = function (newWidth) { // Set rectangel width function | |
this.width = newWidth; // Use 'this as placeholder to modify object called | |
}; | |
rectangle.setHeight (6); // Change rectangle height 6 | |
rectangle.setWidth (8); // Change rectangle width 8 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment