Difficulty: Easy
Correct Answer: language
Explanation:
Introduction / Context:
HTML script tags historically used several attributes to specify scripting information. Before the widespread adoption of the type attribute with MIME types such as text/javascript, the language attribute was often used to indicate that the script contained JavaScript and sometimes even a specific version. This question checks awareness of older but still encountered HTML practices, which is useful when maintaining legacy web pages.
Given Data / Assumptions:
Concept / Approach:
The language attribute on <script> historically specified both the scripting language and sometimes the version. For example, language="JavaScript1.2" or language="JavaScript". Over time, the W3C and browser vendors shifted toward using the type attribute with values such as text/javascript and later application/javascript, and the language attribute became deprecated. However, the attribute that can hold a JavaScript version string in legacy code is language, not script or version. Understanding this legacy behaviour helps in interpreting older HTML documents correctly.
Step-by-Step Solution:
Step 1: Identify the script element as <script> and recall that attributes define its scripting language and behaviour.
Step 2: Remember that language was used in early HTML to specify the scripting language and could include version numbers, as in language="JavaScript1.2".
Step 3: Recognise that there is no standard script attribute on the <script> tag used for versioning, despite the element name itself being script.
Step 4: Note that there is no widely used version attribute on <script> in standard HTML for this purpose.
Step 5: Conclude that language is the attribute that can hold the JavaScript version string, which matches option C.
Verification / Alternative check:
Older HTML examples, especially from the early days of JavaScript, show usage such as <script language="JavaScript1.3"> to indicate that the code requires a certain JavaScript version. In contrast, the type attribute might simply be text/javascript. While modern best practice is to omit language and rely on type or defaults, the historical record confirms that language was the attribute used for language and version indication. This backs up the correctness of option C.
Why Other Options Are Wrong:
Option A, script, is not an attribute; it is the element name itself. Option B, version, is not a standard HTML attribute for <script>, so using it would not communicate version information to browsers. Option D, none of the above, is incorrect because language was actually used in practice. Option E, charset, is an attribute that specifies character encoding, not JavaScript version. Therefore, only the language attribute fits the description in the question.
Common Pitfalls:
Developers familiar only with modern HTML5 practices may never have seen the language attribute and might assume that type or custom data attributes would hold version information. Another pitfall is confusing the language attribute on <script> with the lang attribute on other elements, which indicates natural language rather than scripting language. In interviews, noting that language historically indicated JavaScript and version but is now deprecated shows a well rounded understanding of web development history.
Final Answer:
The language attribute of the <script> tag was traditionally used to hold the JavaScript version, for example language="JavaScript1.2".
Discussion & Comments