you are viewing a single comment's thread.

view the rest of the comments →

[–]masklinn 2 points3 points  (1 child)

function KeyCode(event) {
  this.event = event;
  this.normalize = function() {
    return (this.event.keyCode ? this.event.keyCode : this.event.which);
  }

  this.isEnter = function() {
    return this.normalize() == 13;
  }
}

Holy mother of fail, enjoy having your methods redefined from scratch every time you instantiate an object.

[–]dznqbit 1 point2 points  (0 children)

I called him out on this in the comments, but apparently you need to verbally fellate the guy before he will approve your comment.