-
-
Save hex13/8d55f35389b02f8eb396209a633f4d4a 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
// object literal. Very flexible and with shorthand notation for methods, it's very nice. | |
const obj = { | |
addTodo() { | |
}, | |
removeTodo() { | |
}, | |
transactions: { // sub object | |
fetchTodos() { | |
} | |
} | |
} | |
// ES6 (without drafts) | |
class ToDo { | |
// I don't want to do this because it's draft. | |
// static transactions = { | |
// fetchTodos() {} | |
//} | |
addTodo() { | |
} | |
removeTodo() { | |
} | |
} | |
// so old way | |
ToDo.prototype.transactions = { | |
fetchTodos() { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment