KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm trying to call a function within an object literal that I created, using the this keyword. But an error shows up saying this.doTheMove() is not a function: window.onload = function(){ var animBtn = document.getElementById('startAnim'); animBtn.addEventListener('click', Animation.init, false); } var Animation = { init: function(){ this.doTheMove(); // I'm calling the function here, but it gives an error. }, doTheMove: function(){ alert('Animation!'); } } Why is there an error?
Tags (comma-separated)
Save Edits
Cancel