-8

I am learning to make library like jquery and trying to understand a piece of code where this.e is giving me hard time, where this 'e' come from and they are assigning object to it but when they return this they return just this not this.e .

function _(a) {
  var b = {
    key: "some val"
  };
  if (a) {
    if (window === this) {
      return new _(a)
    }
    this.e = document.getElementById(a);
    return this
  } else {
    return b
  }
}
_.prototype = {
    hide: function() {
      this.e.style.display = "none";
      return this
    }

HTML

<button onclick="_('abc')">click</button>
<div id="abc" style="width: 200px; height: 100px; background-color: pink;">   </div>
karthikr
  • 92,866
  • 25
  • 190
  • 186

1 Answers1

-3

It's just a convention to use e as function parameter name when the parameter is event. as in your example here the event is onclick

peter
  • 1
  • 5