From 8c69ce10a4116de7deb06e1371bd79fcdfcb540a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Patrick=20Deba=C3=ABne?= Date: Sat, 15 Apr 2023 23:28:10 +0200 Subject: [PATCH] section 7 : functions exercices --- session7/exercice1.html | 12 ++++++++++++ session7/exercice1.js | 13 +++++++++++++ session7/exercice2.html | 12 ++++++++++++ session7/exercice2.js | 11 +++++++++++ 4 files changed, 48 insertions(+) create mode 100644 session7/exercice1.html create mode 100644 session7/exercice1.js create mode 100644 session7/exercice2.html create mode 100644 session7/exercice2.js diff --git a/session7/exercice1.html b/session7/exercice1.html new file mode 100644 index 0000000..bad7774 --- /dev/null +++ b/session7/exercice1.html @@ -0,0 +1,12 @@ + + + + + + + Exercice 1 + + + + + \ No newline at end of file diff --git a/session7/exercice1.js b/session7/exercice1.js new file mode 100644 index 0000000..30aa9b2 --- /dev/null +++ b/session7/exercice1.js @@ -0,0 +1,13 @@ +function abracadabra() { + let first_name = prompt("First name ?"); + let last_name = prompt("Last name ? "); + let age = prompt("Age ?"); + + alert("Sapristi ! On ne m'avait pas prévenu que c'était vous, " + + first_name + + " ! Euh... Je veux dire... Monsieur le grand magicien " + + last_name + + " ! Cela fait déjà ${age} ans que vous faites rayonner notre contrée !.") +} + +abracadabra(); \ No newline at end of file diff --git a/session7/exercice2.html b/session7/exercice2.html new file mode 100644 index 0000000..293cceb --- /dev/null +++ b/session7/exercice2.html @@ -0,0 +1,12 @@ + + + + + + + Exercice 2 + + + + + \ No newline at end of file diff --git a/session7/exercice2.js b/session7/exercice2.js new file mode 100644 index 0000000..fc76906 --- /dev/null +++ b/session7/exercice2.js @@ -0,0 +1,11 @@ +function bodyMassIndex(mass, height) { + // Height in meters + metersHeight = Number(height) / 100; + let bmi = mass / Math.pow(Number(height) / 100, 2); + return bmi +} + +let mass = prompt("Mass (kg)?"); +let height = prompt("Height (cm)?") + +alert(bodyMassIndex(mass, height)); \ No newline at end of file