Consider the following sentences:
It is a recursive function. It is initially called on the root node of the DOM tree (body element).
To combine them I thought to say
It is a recursive function and is initially called on the root node of the DOM tree (body element).
To refine it I thought to say:
It is a recursive function which is initially called on the root node of the DOM tree (body element).
But I doubt the last sentence is grammatical.
Can “which” be used to relate such sentences? Because it doesn’t distinguish something from other similar things. It is just one function.Other examples:
He is a boy. He goes to school every day.
Can I say :
He is a boy who goes to school every day!
Answer
The difference between the use of and
and which
is very subtle and technical. And
is a coordinating conjunction that can link two equally important things. In this specific case, and
links two equally important verb phrases:
It is [something] and is called on [something].
Which
is a subordinating conjunction, which is generally used to join a less important clause to a more important one. The clause (idea) that begins with the subordinating conjunction is the subordinate clause. Subordinate (aka dependent) clauses are often deemed less important ideas because they act as modifiers to the main (independent) clause. In this example, the idea
It is a recursive function
is the main point, and the fact that it is initially called on the root node of the DOM tree
is more for context. The emphasis here is on the core concept of a recursive function
rather than its specific use.
Even though the raw content of the two sentences is the same, the subtle difference between the coordinating and
and the subordinating which
implies a change in the relative importance of the ideas.
Attribution
Source : Link , Question Author : Ahmad , Answer Author : ryanyuyu