2024-02-16 14:27:07 +01:00
|
|
|
include::../rule.adoc[tag=header]
|
2023-11-15 14:55:23 +01:00
|
|
|
|
|
|
|
=== Code examples
|
|
|
|
|
|
|
|
==== Noncompliant code example
|
|
|
|
|
|
|
|
[source,javascript,diff-id=1,diff-type=noncompliant]
|
|
|
|
----
|
|
|
|
function JavaScript101() {
|
2024-02-16 14:27:07 +01:00
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<h1>JavaScript Programming Guide</h1>
|
|
|
|
<p>An introduction to JavaScript programming and its applications.</p>
|
2023-11-15 14:55:23 +01:00
|
|
|
|
2024-02-16 14:27:07 +01:00
|
|
|
<h2>JavaScript Basics</h2>
|
|
|
|
<p>Understanding the basic concepts in JavaScript programming.</p>
|
2023-11-15 14:55:23 +01:00
|
|
|
|
2024-02-16 14:27:07 +01:00
|
|
|
<h3>Variables</h3>
|
|
|
|
<p>Explanation of what variables are and how to declare them in JavaScript.</p>
|
2023-11-15 14:55:23 +01:00
|
|
|
|
2024-02-16 14:27:07 +01:00
|
|
|
<h3 aria-hidden>Data Types</h3> // Noncompliant
|
|
|
|
<p>Overview of the different data types in JavaScript.</p>
|
2023-11-15 14:55:23 +01:00
|
|
|
|
2024-02-16 14:27:07 +01:00
|
|
|
<h3 /> // Noncompliant
|
|
|
|
<p>Understanding how to declare and use functions in JavaScript.</p>
|
|
|
|
</>
|
|
|
|
);
|
2023-11-15 14:55:23 +01:00
|
|
|
}
|
|
|
|
----
|
|
|
|
|
|
|
|
==== Compliant solution
|
|
|
|
|
|
|
|
[source,javascript,diff-id=1,diff-type=compliant]
|
|
|
|
----
|
|
|
|
function JavaScript101() {
|
2024-02-16 14:27:07 +01:00
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<h1>JavaScript Programming Guide</h1>
|
|
|
|
<p>An introduction to JavaScript programming and its applications.</p>
|
2023-11-15 14:55:23 +01:00
|
|
|
|
2024-02-16 14:27:07 +01:00
|
|
|
<h2>JavaScript Basics</h2>
|
|
|
|
<p>Understanding the basic concepts in JavaScript programming.</p>
|
2023-11-15 14:55:23 +01:00
|
|
|
|
2024-02-16 14:27:07 +01:00
|
|
|
<h3>Variables</h3>
|
|
|
|
<p>Explanation of what variables are and how to declare them in JavaScript.</p>
|
2023-11-15 14:55:23 +01:00
|
|
|
|
2024-02-16 14:27:07 +01:00
|
|
|
<h3>Data Types</h3>
|
|
|
|
<p>Overview of the different data types in JavaScript.</p>
|
2023-11-15 14:55:23 +01:00
|
|
|
|
2024-02-16 14:27:07 +01:00
|
|
|
<h3>Functions</h3>
|
|
|
|
<p>Understanding how to declare and use functions in JavaScript.</p>
|
|
|
|
</>
|
|
|
|
);
|
2023-11-15 14:55:23 +01:00
|
|
|
}
|
|
|
|
----
|
|
|
|
|
2024-02-16 14:27:07 +01:00
|
|
|
include::../rule.adoc[tag=footer]
|