Created
September 29, 2015 07:27
-
-
Save snowmantw/8850eca5d51f01ff03f9 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
TodoListManager.prototype.onItemChecked = function(event) { | |
// Do something when the Todo item is clicked. | |
var checked = event.target.classList.contains('checked'); | |
var todoId = Number.parseInt(event.target.dataset.todoId, 10); | |
this._listTodoItem[todoId].checked = checked; | |
}; | |
TodoListManager.prototype.start = function() { | |
window.addEventListener('click', this.onItemChecked) | |
}; |
是因為this嗎??
這個this是指Window,但是此處this應該是要指TodoListManager.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Put why the 9th line is wrong in comments.