Function returning itself instead of return value?

So I was getting weird errors on the conversion of my textColor variable. After some debugging I found this:

The first time I call this:

alert(this.contents.textColor);I get this:

whatigotnow.png


http://s15.postimg.org/9ya8mks1n/whatigotnow.png

Anytime after that it nicely displays #ffffff. But the FIRST iteration during gameplay is a problem for other methods like darken(this.contents.textColor)

WHAT??? Why does it return the entire function itself instead of just the result?
Because it is a function. If you want to run the function, you have to add () at the end:

Code:
alert(this.contents.textColor());
Ooooh.... I never saw the missing parentheses... Thanks.

I see. In a window we have:

this.contents.textColor = <some color>;this.contents.textColor;and we have

this.changeTextColor();this.textColor();are the same but one is a function and one is not. That was confusing 😛
Ooooh.... I never saw the missing parentheses... Thanks.

I see. In a window we have:

this.contents.textColor = <some color>;this.contents.textColor;and we have

this.changeTextColor();this.textColor();are the same but one is a function and one is not. That was confusing 😛
i feel your suffer bro 😀 . currently learning javascript and sometimes it's really absurd. 😛 .
this.contents.textColor()

Original thread: https://forums.rpgmakerweb.com/threads/function-returning-itself-instead-of-return-value.49189/