JavaScript / Code (page 3)
<!DOCTYPE html>
<html>
<body>
<h2>Math</h2>
<p id="example"></p>
<script>
document.getElementById("example").innerHTML =
Math.floor(Math.random() * 2000);
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<body>
<h1>Set</h1>
<p id="example"></p>
<script>
const A = new Set(['a','b','c']);
const B = new Set(['b','c','d']);
const C = new Set(['c','d','b']);
const D = A.intersection(C);
let text = "";
for (const x of D) {
text += x;
}
document.getElementById("example").innerHTML = "The intersection is: " + text;
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<body>
<h1>Set</h1>
<p id="example"></p>
<script>
const A = new Set(['a','b','c']);
const B = new Set(['b','c','d']);
const C = new Set(['c','d','b']);
const D = A.intersection(C);
let text = "";
for (const x of B) {
text += x;
}
document.getElementById("example").innerHTML = "The intersection is: " + text;
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<body>
<h1>Set</h1>
<p id="example"></p>
<script>
const A = new Set(['a','b','c']);
const B = new Set(['b','c','d']);
const C = new Set(['c','d','b']);
const D = new Set(['f','a','b']);
const E = new Set(['b','c','d']);
const F = A.intersection(E);
let text = "";
for (const x of E) {
text += x;
}
document.getElementById("example").innerHTML = "The intersection is: " + text;
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<body>
<h2>Switch</h2>
<p id="example"></p>
<script>
let text;
switch (new Date().getDay()) {
case 6:
text = "First day of the weekend !!!";
break;
case 0:
text = "Nice to sleep all the morning !!!";
break;
default:
text = "Don't be sad ! Weekend is waiting for us !";
}
document.getElementById("example").innerHTML = text;
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<body>
<h2>Switch</h2>
<p id="example"></p>
<script>
let text;
switch (new Date().getDay()) {
case 4:
text = "First day of the weekend !!!";
break;
case 0:
text = "Nice to sleep all the morning !!!";
break;
default:
text = "Don't be sad ! Weekend is waiting for us !";
}
document.getElementById("example").innerHTML = text;
</script>
</body>
</html>
Reproduce this code, choosing one of the compilers below (don't copy and paste! It would be too easy). They all have the same function, just choose one according to your preferences.
When copying your code, replace the existing (default) code already in the compiler with your own.
Warning ! Choose the compiler based on the formatting (e.g., with or without HTML tags). For some of these compilers, you must choose the programming language yourself from the menu that is then offered. Of course, don't forget to click on RUN !
Some of the external links presented below, are not under the direct responsibility of Fond of Code. We cannot therefore be held responsible for the quality/Viability, or the temporary nor permanent interruption of some of them.
» Creation date: 1995
* Created by Brendan Eich
* Developed and supported by ECMAScript, Netscape Communications Corporation, Mozilla Foundation
* Influenced by Java, C ++, PERL and Python
* Multiplatform
The comments you leave us are systematically subject to rigorous moderation. Incivility and slander, threats, intimidation of all kinds, more generally all gratuitous verbal violence, or the dissemination of unverified information... are not tolerated. We also reserve the right to publish only comments which effectively advance the debate and allow a better understanding of the subject covered by the article presented on this page (as well as all its ramifications) and this, whatever its overall content.
Fond of Code TM © ®
All rights reserved - Protected Trademark/Logo (INPI)
Legal structures based in
Nice - FRANCE
Montreal - Canada
By appointment
SIRET: 41138921600028 (France)
Inc. : 661515-5 (Canada, Qc.)
Official resumption in France : March 2025
Beta version of the website : May 2024
Implementation : July 2024
Launch of initial activity : 1996 (Europe and North America)
New version of the website : April 2025
Fond of Code official launch : May 2025