1

Source: JavaScript for Kids: A Playful Introduction to Programming by Nick Morgan

Example:

In this chapter, you learned how to write JavaScript that runs only when you want it to. The setTimeout and setInterval functions are great for timing code to run after a delay or at certain intervals. If you want to run code when the user does something in the browser, you can use events like click and mousemove, but there are many others.

I'm a little bit confused with whether the word timing is used as an adjective that describes code or a gerund with code being the object of the verb timing. I'm leaning more toward the gerund option, however, because that simply makes much more sense here semantically. I'm not sure though. What do you think?

  • A noun functioning as an attribute. – V.V. Nov 17 '15 at 11:39
  • 2
    The sentence could be paraphrased "are useful for those situations when you want to schedule code so that it will run after a delay or at certain intervals". The code referenced in the sentence is not the code that creates the schedule, but the code that is executed on the specified schedule. – Tᴚoɯɐuo Nov 17 '15 at 11:47
  • 1
    It's a "gerund-participle" derived from the verb "to time". You can use the setTimeout function to time a section of code so that it runs after a delay. – CowperKettle Nov 17 '15 at 13:03
1

Objects of prepositions want nouns or noun phrases, so for timing means timing has to be a noun.

-ing forms of words that act as nouns are a form of verbal called gerunds.

While gerunds work as nouns, since they are a verbal, they can take objects. So code is the object of the verbal timing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.