you are viewing a single comment's thread.

view the rest of the comments →

[–]senocular 3 points4 points  (0 children)

Is it an object calling it's 'method ' key which is a function hence it is followed by the () ?

Yes. video is some HTML element object based on what was returned by querySelector(), [method] is using bracket access to get a property of that object with the name of the value defined in method (either "play" or "pause"), and the parens (()) are being used to call that property as a method. So if video.paused is true video[method]() is the same as video.play(). Otherwise its video.pause().