diff --git a/01/assets/js/app.js b/01/assets/js/app.js index 9323b98d..aaa0a2d6 100644 --- a/01/assets/js/app.js +++ b/01/assets/js/app.js @@ -1,4 +1,31 @@ -const a = '4.2'; +const a = "4.2"; const b = 9; -console.log(a, b); \ No newline at end of file +console.log(a, b); + +console.log("Typem zmienne b jest:", typeof b); +console.log("Typem zmienne a jest:", typeof a); + +const operations = ["+", "-", "*", "/", "%"]; + +const results = operations.map((operation) => { + switch (operation) { + case "+": + return Number(a) + Number(b); + case "-": + return Number(a) - Number(b); + case "*": + return Number(a) * Number(b); + case "/": + return Number(a) / Number(b); + case "%": + return Number(a) % Number(b); + } +}); + +results.forEach((result, index) => { + const operation = operations.at(index); + console.log( + `${a} ${operation} ${b} is ${result > 20 ? "greater" : "less"} than 20` + ); +}); diff --git a/01/index.html b/01/index.html index 5c55d687..fa2fad9d 100644 --- a/01/index.html +++ b/01/index.html @@ -1,12 +1,12 @@ -
- - - + + + +