Question:

What does the following code print to the console?

function Builder () {
  this.self = function () {
    return this;
  }
}
b = new Builder();
console.log(b.self() === b);

Answer:

true

For constructor functions, "this" refers to the object that's created by the constructor function.


Keywords:

© 2017 QuizBucket.org