Skip to content

Instantly share code, notes, and snippets.

@jasonblanchard
Created January 22, 2016 01:30
Show Gist options
  • Select an option

  • Save jasonblanchard/4090a06544d4b8c57038 to your computer and use it in GitHub Desktop.

Select an option

Save jasonblanchard/4090a06544d4b8c57038 to your computer and use it in GitHub Desktop.
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