diff --git a/exercice_001/exo1.js b/exercice_001/exo1.js
index dde6c41..e54c11d 100644
--- a/exercice_001/exo1.js
+++ b/exercice_001/exo1.js
@@ -1,18 +1,18 @@
document.getElementById("main-title").innerText = "Input Output";
-function exo1b(){
+function exo1b() {
let userInput = document.getElementById("input-1").value;
document.getElementById("result-box-1").innerText = userInput;
}
-function getInputEqualityMessage(input1, input2){
- if(input1 === input2){
+function getInputEqualityMessage(input1, input2) {
+ if (input1 === input2) {
return "input-1 = input-2";
}
return "input-1 != input-2";
}
-function exo1c(){
+function exo1c() {
let input1 = document.getElementById("input-1").value;
let input2 = document.getElementById("input-2").value;
@@ -24,34 +24,34 @@ function isNumber(str) {
}
function getIsNumberMessage(input) {
- if(isNumber(input)){
+ if (isNumber(input)) {
return "Number!";
}
return "n'est pas un nombre";
}
-function exo1d(){
+function exo1d() {
let input1 = document.getElementById("input-3").value;
document.getElementById("result-box-3").innerText = getIsNumberMessage(input1);
}
function getSizeMessage(n) {
- if(n < 1000){
+ if (n < 1000) {
return "plus plus petit que 1000";
}
return "plus plus grand que 1000";
}
function getSafeSizeMessage(input) {
- if(!isNumber(input)){
+ if (!isNumber(input)) {
return "n'est pas un nombre";
}
return getSizeMessage(parseInt(input));
}
-function exo1e(){
+function exo1e() {
let input1 = document.getElementById("input-4").value;
document.getElementById("result-box-4").innerText = getSafeSizeMessage(input1);
diff --git a/exercice_001/exo2.html b/exercice_001/exo2.html
new file mode 100644
index 0000000..2513b59
--- /dev/null
+++ b/exercice_001/exo2.html
@@ -0,0 +1,96 @@
+
+
+
+
+
+ title
+
+
+
+
+
+
+
+
+
+
+
+ #result-box-1
+
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
+
+
+
+
+ #result-box-2
+
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
+
+
+
+
+ #result-box-3
+
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
+
+
+
+
+ #result-box-4
+
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/exercice_001/exo2.js b/exercice_001/exo2.js
new file mode 100644
index 0000000..fb669e6
--- /dev/null
+++ b/exercice_001/exo2.js
@@ -0,0 +1,40 @@
+document.getElementById("main-title").innerText = "Indirections";
+
+function exo1b() {
+ let userInput1 = document.getElementById("input-1").value;
+ let userInput2 = document.getElementById("input-2").value;
+ let userInput3 = document.getElementById("input-3").value;
+ let userInput4 = document.getElementById("input-4").value;
+ let output = userInput1 + userInput2 + userInput3 + userInput4;
+ document.getElementById("result-box-1").innerText = output;
+}
+
+
+function exo1c() {
+ let userInput = document.getElementById("input-2").value;
+ let targetInput = document.getElementById("input-" + userInput).value;
+
+ document.getElementById("result-box-2").innerText = targetInput;
+}
+
+function exo1d() {
+ let userInput = document.getElementById("input-3").value;
+ let target = document.getElementById("button-" + userInput).innerText;
+
+ document.getElementById("result-box-3").innerText = target;
+}
+
+function getValueOrInnerHtml(htmlElement) {
+ if (htmlElement.innerText !== '') {
+ return htmlElement.innerText;
+ }
+ return htmlElement.value;
+}
+
+
+function exo1e() {
+ let userInput = document.getElementById("input-4").value;
+ let target = document.getElementById(userInput);
+
+ document.getElementById("result-box-4").innerText = getValueOrInnerHtml(target);
+}
\ No newline at end of file