Calling A Method Within A Javascript Object
I'm trying to create a javascript object that can call other methods within itself. However, I'm running into a weird problem that I just can't seem to figure out. I have the foll
Solution 1:
There's an extra set of parenthesis here:
this.doSecondInit() = function() {
You can't assign to the result of a function call, let alone to the result of a function that doesn't even exist.
After your edit, your thing seems to work fine:
You sure you didn't have the same typo in your actual code? Better start getting used to not putting that ()
after every function call, which is probably a bad habit carried over from languages where functions aren't values.
Post a Comment for "Calling A Method Within A Javascript Object"