Created
January 22, 2016 01:30
-
-
Save jasonblanchard/4090a06544d4b8c57038 to your computer and use it in GitHub Desktop.
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 myApp = { | |
| todos: [ | |
| { | |
| id: 1, | |
| text: 'learn javascript', | |
| complete: false | |
| }, | |
| { | |
| id: 2, | |
| text: 'eat pizza', | |
| complete: true | |
| } | |
| ], | |
| initialId: function() { | |
| return this.todos.length; | |
| }, | |
| id: null, | |
| incrementId: function() { | |
| if (this.id) { | |
| this.id++; | |
| } else { | |
| this.id = this.initialId(); | |
| } | |
| return this.id; | |
| } | |
| }; | |
| // console.log(myApp.incrementId()); | |
| // console.log(myApp.incrementId()); | |
| // var newValue = 'cats'; | |
| // console.log(newValue); | |
| myApp.newValue = 'cats'; | |
| console.log(myApp.newValue); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment