Skip to content

Instantly share code, notes, and snippets.

@cba85
Created September 8, 2024 13:20
Show Gist options
  • Save cba85/643db047e4cf83edf4ffca6451e7f367 to your computer and use it in GitHub Desktop.
Save cba85/643db047e4cf83edf4ffca6451e7f367 to your computer and use it in GitHub Desktop.
2024-2025 - IPI Toulouse - IJVS010
function max(a, b) {
if (a > b) {
return a;
}
return b;
}
console.log(max(1, 5));
console.log(max(2, 2));
console.log(max(4, 1));
function checkIfSpam(text) {
const message = text.toLowerCase().trim();
if (message.includes("viagra") || message.includes("pills")) {
return true;
}
return false;
}
console.log(checkIfSpam("lorem ipsum"));
console.log(checkIfSpam(" viagra "));
console.log(checkIfSpam("ViAgRa"));
const name = "Clément";
const msg = "Bonjour"
console.log(msg + " " + name);
console.log(`${msg} ${name}`);
let myData = "Manchester,London,Liverpool,Birmingham,Leeds,Carlisle";
let englishCities = myData.split(",");
englishCities.push("Bradford");
englishCities.unshift("Leicester");
for (let i = 0; i < englishCities.length; i++) {
console.log(englishCities[i]);
}
for (const city of englishCities) {
console.log(city);
}
alert('ok')
const firstname = prompt("Comment tu t'appelles ?");
console.log(firstname);
const quit = confirm("Etes vous sur de vouloir quitter la page ?");
if (quit) {
window.close();
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="medical.js"></script>
</head>
<body>
<!-- <script>alert('inline');</script> -->
</body>
</html>
let douleur = prompt("Douleur ?");
douleur = douleur.toLowerCase().trim();
if (douleur == "abdomen") {
alert("Appendicite");
} else if (douleur == "gorge") {
const fievre = confirm("Fièvre ?");
if (fievre) {
alert("Rhume");
} else {
alert("Mal de gorge");
}
} else if (douleur == "aucune") {
const toux = confirm("Toux ?");
if (toux) {
const fievre = confirm("Fièvre ?");
if (fievre) {
alert("Rhume");
} else {
alert("Refroidissement");
}
} else {
alert("Rien");
}
} else {
alert("Non géré");
window.close();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment