My problem is to know who is the Subject of setting and it the following sentence:

When it is invoked, our new function simply invokes the original function that was passed in, setting the original value as this. It also passes through the arguments.

Source: https://yehudakatz.com/2011/08/11/understanding-javascript-function-invocation-and-this/, section: Using Function.prototype.bind.

  1. Does the ", setting ..." expanded to ", and the new function setting" or ", the original function setting"?
  2. Does the "It also passes ..." expanded to "the original function also passes" or "the new function also passes"?
  • 1
    It's worth noting, in the context of JavaScript documentation, that "this" is actually the noun this, not a demonstrative pronoun as usual. Commented Apr 18, 2021 at 3:01

1 Answer 1


Here “setting the original value as this” is a participle phrase modifying “our new function”. I'm not entirely sure this is good style, but it's something I've seen (and written) frequently in program documentation.

Here, the participle phrase describes something the function is doing during the main action of the sentence. So, while the function “invokes the original function” it is also “setting the original value as this”.

As for “It” in the second sentence, it's also referring to “our new function”.

  • Your answer help me a lot, thank you.
    – Rain
    Commented Apr 18, 2021 at 3:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .