Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • Why is 'this' for inner function 'parse' is same as 'IntegerParser' but for 'fiterBy' function is Global object? Since 'this.parse' and 'this.filterBy' both are inner functions. Commented May 28, 2018 at 8:48
  • @Vishal-Lia It is because we are assigning a new object to prototype of ParseParameter. In case of objects the this refers to the object itself. Commented May 28, 2018 at 8:56
  • How would be in case I use the prototype syntax, I mean, instead of this.filterBy write IntegerParse.protoype.filterBy, how could I attach the context? Commented May 28, 2018 at 15:25
  • 1
    @JoseRojas You can in that case use JavaScript's call or apply or bind methods for specifying the context or reference of this keyword. Read more here: medium.com/@omergoldberg/… Commented May 28, 2018 at 19:16