I just read the following paragraph:

Strings are useful for holding data that can be represented in text form. Some of the most-used operations on strings are to check their length, to build and concatenate them using the + and += string operators, checking for the existence or location of substrings with the indexOf() method, or extracting substrings with the substring() method.

I want to know why they can change from "to check" and "to build" to "checking" and "extracting". Is this technique common in everyday writing? My understanding is that we should be consistent, i.e. either all "Ving" or all "to V", but it looks like I might be wrong. Any advice?

  • 8
    Documentation is not known for its literary value. It is often written by programmers or engineers who may have no training in writing and may not even have English as a first language.
    – Stuart F
    Commented Apr 7 at 5:53

4 Answers 4


I think you are correct, but this is a minor flaw. The sentence is "functional". You can learn what strings are for and what operations are commonly used on strings. However it is not especially well written, in particular "One of the most used operations is to check the length of a string" doesn't quite work, since the infinitive seems to give the purpose of the operation rather than what the operation is.


It's a mistake. They could say "to verb", or they could say "verbing", but they should have been consistent.

I am suddenly reminded of a lecture I once attended where the speaker talked about consistency, and he had a slide with his main points identified as "1", "B", and "3rd".


I would find nothing wrong with either of these:

One of the most used operations is to check on the length of the string.

One of the most used operations is checking on the length of the string.

(To "check on" suggests that the string length is growing or shrinking during processing, e.g. as a result of appending substrings or removing extra "white-space".)

The non-finite clauses are like noun-phrases and work fine with One of the most used operations is, which would resolve to a single operation.


One of my most important duties is watering the plants.

One of my most important duties is to water the plants.

Inconsistency, switching back and forth between the two non-finite forms, is not a grammatical error but a stylistic issue.

My most important duties are walking the dog, to bring in the mail and the newspaper, and watering the plants.

  • I would say the items in that list of duties should be grammatically parallel. You could, however, introduce other kinds of nouns than verbal nouns: “Arson, murder and jaywalking.”
    – Davislor
    Commented Apr 7 at 17:15
  • By that do you mean that it's more than a stylistic issue, that it's ungrammatical?
    – TimR
    Commented Apr 7 at 17:19
  • It sounds wrong to me, yes.
    – Davislor
    Commented Apr 7 at 17:30
  • @Davislor TVTropes warning!
    – gidds
    Commented Apr 7 at 18:33
  • 1
    In this context 'checking on' would actually be less appropriate; the length of a string isn't necessarily changing or expected to change.
    – aantia
    Commented Apr 8 at 10:43

I'm not certain that it was actually necessary or correct to write it in this way, but I would at least speculate that the author's reasoning was similar to mine here:

While at first this appears to be a mistake (in style if not grammar), note that the 'Verbing' phrases refer to calling methods (indexOf() and substring()), while the 'to Verb' phrases refer respectively to checking an object property and implicitly calling the concatenation methods via the + and += operators.

The distinction is that the operation being referred to is a procedure in the 'to Verb' cases vs simply calling a pre-existing method in the 'Verbing' cases. To put them all in the 'Verbing' format while maintaining consistency the author would have had to write something to the effect of 'checking their length with the intrinsic getLength method', which would not reflect the standard way of performing the operation very well.

  • 1
    At second and at third, it's still an unneeded inconsistency, which only at my most gracious can I refrain from calling a mistake. I recognize the distinctions you are pointing out, but the difference in wording doesn't even do a good job of bringing those out. From an English style perspective, I see no good justification for mixing verb forms in the proffered sentence. Commented Apr 8 at 20:13
  • @JohnBollinger I'm inclined to agree with you, but I thought it was interesting that the switch in phrasing had a reason (even if the reason wasn't sensible). There's also a chance that this is in fact the preferred style in javascript spec documentation (or something adjacent); my answer might make it a little easier to find that out.
    – aantia
    Commented Apr 9 at 10:38

You must log in to answer this question.

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