I'm learning Javascript and I've come across something I don't understand. This is the part of my object code:
var monster =
{
...
//is the animation starting?
hiding: true,
delayDuration: Math.floor(Math.random() * 60),
currentDelay: this.delayDuration,
...
};
If I console.log (delayDuration) I get a value, but if I console.log (currentDelay) it says 'undefined'.
I don't understand why currentDelay doesn't take the value of delayDuration. Can someone please explain this?
edit: @Bergi why did you mark this as duplicate? I couldn't find my question answered somewhere else edit2: yup, it's a duplicate. At least now I know the words for what I was asking.