Is this(self) same as hero?

var ChuckBerry  = {
  track: " Johnny B. Goode",
  song : function() {
    pet.debug("The " + hero.type + " likes " + this.track);  
    return this.track;

console output:

The captain likes  Johnny B. Goode
Johnny B. Goode

Short answer: No

1 Like

I think the self and hero are only the same if you use it like this:

self.moveXY(22, 22)
hero.moveXY(22, 22)

I must admit I do not understand this… I’m sure you’re right, but I just don’t get how that would say so. It looks like nice code, javascript always looks very fancy :smile:

1 Like