0

I have been dealing with an intermittent and very elusive problem in a javascript. After injecting debug code over the course of time, I have found the point where the script breaks within a function. However, I am not understanding why it breaks here.

To get to the point, I have this:

openNewTab : function (evt) {

  ....

  dump("typeof evt : "+(typeof evt)+"    ");        // prints "object"
  dump("typeof evt.altKey : "+(typeof evt.altKey)+"    ");        // breaks here, prints nothing

  ....

}

The first dump prints "object", indicating to me evt is a valid object. However, nothing is printed on the next dump, and the script breaks at that point.

In my understanding, if evt is an object, then even if evt.altKey did not exist, it should at the very least dump "undefined".

Is there more to know about how typeof works that I am not understanding?

KevinHJ
  • 1,014
  • 11
  • 24

0 Answers0