Last active
October 9, 2016 04:54
-
-
Save helanan/fbabd64ead5b7f64b3f810d7b7c516e5 to your computer and use it in GitHub Desktop.
Create an Object Using Literal Notation
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
var inStock = { | |
item: 'T-Shirt', | |
available: 40, | |
purchased: 25, | |
checkStock: function() { | |
return this.available - this.purchased; | |
} | |
}; | |
var elItem = document.getElementById('shirtsInstock'); | |
elItem.textContent = inStock.item; | |
var elAvailable = document.getElementById('available'); | |
elRooms.textContent = inStock.checkStock(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment