If one's question about a tool is answered in that tool's official documentation or well-known tutorials on a site intended for professional and enthusiast programmers who at least Google their problems (such as Stack Overflow) then that one deserves to be told to RTFM. In fact, being told to RTFM could improve him/her as a programmer, as (s)he can then realize that online programming communities don't necessarily replace basic research skills.
In other words, vote to close as off-topic with this custom reason:
Stack Overflow is not a substitute for a minimal understanding of the documentation/tutorial/whatever of the language/framework/library/IDE/whatever you're using. Please read [the fucking manual](link to the documentation/tutorial/whatever) before asking a question about [insert the language/framework/library/IDE/whatever the question is about here] here.
So in this case, your close reason would end with "please RTFM before asking a JavaScript question" (note the link to MDN).