diff --git a/01/assets/js/app.js b/01/assets/js/app.js
index 9323b98d..c4475e92 100644
--- a/01/assets/js/app.js
+++ b/01/assets/js/app.js
@@ -1,4 +1,54 @@
const a = '4.2';
const b = 9;
-console.log(a, b);
\ No newline at end of file
+console.log(a, b);
+
+console.log(typeof a, typeof b);
+
+let addition = parseFloat(a) + b;
+let substraction = a - b;
+let multiplication = a * b;
+let division = a / b;
+let modulo = a % b;
+let increment = a;
+increment++;
+let decrement = a;
+decrement--;
+
+console.log(
+ addition,
+ substraction,
+ multiplication,
+ division,
+ modulo,
+ increment,
+ decrement
+);
+
+if (addition > 20) {
+ console.log('Addition result is grtater than 20');
+}
+
+if (substraction > 20) {
+ console.log('Substraction result is grtater than 20');
+}
+
+if (multiplication > 20) {
+ console.log('Multiplication result is grtater than 20');
+}
+
+if (division > 20) {
+ console.log('Division result is grtater than 20');
+}
+
+if (modulo > 20) {
+ console.log('Modulo result is grtater than 20');
+}
+
+if (increment > 20) {
+ console.log('Incrementation result is grtater than 20');
+}
+
+if (decrement > 20) {
+ console.log('Decrementation result is grtater than 20');
+}
diff --git a/01/index.html b/01/index.html
index 5c55d687..321171b0 100644
--- a/01/index.html
+++ b/01/index.html
@@ -1,12 +1,15 @@
+
devmentor.pl - JS BASICS - #01
+
-
+
+
\ No newline at end of file
diff --git a/02/app.js b/02/app.js
index b397190c..a8ce8a31 100644
--- a/02/app.js
+++ b/02/app.js
@@ -1,7 +1,40 @@
-
/* rozwiązanie z pętlą for */
-const x = 4;
+const x = parseInt(prompt('Podaj liczbę do mnożenia (od 1 do 9)'));
+
+if (x > 0 && x <= 9) {
+ for (let i = 1; i <= 9; i++) {
+ console.log(`${x} x ${i} = ${x * i}`);
+ }
+} else {
+ alert('Podana liczba nie jest z zakresu od 1 do 9');
+}
+
+/* rozwiązanie z pętlą while */
+
+const a = parseInt(prompt('Podaj podstawę potęgi'));
+const n = parseInt(prompt('Podaj wykładnik potęgi'));
+let i = 1;
+let result = a;
+let resultMethod = a;
+if (n === 0) {
+ result = 1;
+} else if (n < 0) {
+ i = -1;
+ while (i > n) {
+ result *= a;
+ resultMethod = resultMethod + ' x ' + a;
+ i--;
+ }
+ resultMethod = '1 / (' + resultMethod + ')';
+ result = 1 / result;
+} else {
+ while (i < n) {
+ result *= a;
+ resultMethod = resultMethod + ' x ' + a;
+ i++;
+ }
+}
-/* rozwiązanie z pętlą while */
\ No newline at end of file
+console.log(resultMethod + ' = ' + result);
diff --git a/02/index.html b/02/index.html
index 30150099..cce0a7e7 100644
--- a/02/index.html
+++ b/02/index.html
@@ -1,12 +1,16 @@
+
devmentor.pl - JS BASICS - #02
+
-
+
+
+
\ No newline at end of file
diff --git a/03/app.js b/03/app.js
index 5b9361e4..0fa0ff44 100644
--- a/03/app.js
+++ b/03/app.js
@@ -7,12 +7,47 @@ const c = randomNumber(min, max);
console.log(a, b, c);
-
-
-
-
-
+const isEven = function (num) {
+ if (typeof num !== 'number') {
+ return null;
+ } else {
+ return num % 2 === 0;
+ }
+};
+
+const sum = getSum(a, b, c);
+const even = isEven(sum);
+
+showInfo(sum, even);
+
+function getSum(a, b, c) {
+ a = parseInt(a);
+ b = parseInt(b);
+ c = parseInt(c);
+
+ if (a <= b && a <= c) {
+ return b + c;
+ } else if (b < a && b <= c) {
+ return a + c;
+ } else {
+ return a + b;
+ }
+}
+
+function showInfo(x, bool) {
+ switch (bool) {
+ case null:
+ console.log(`Podany argument ${x} nie jest liczbą`);
+ break;
+ case true:
+ console.log(`Podany argument ${x} jest parzysty`);
+ break;
+ case false:
+ console.log(`Podany argument ${x} jest nieparzysty`);
+ break;
+ }
+}
function randomNumber(min, max) {
- return Math.round((Math.random() * (max - min)) + min);
-}
\ No newline at end of file
+ return Math.round(Math.random() * (max - min) + min);
+}
diff --git a/04/app.js b/04/app.js
new file mode 100644
index 00000000..2a28b42c
--- /dev/null
+++ b/04/app.js
@@ -0,0 +1,28 @@
+const min = 10;
+const max = 200;
+
+const arr = createArray(min, max);
+const largest = getLargest(arr);
+const avg = getAvg(largest);
+
+console.log('Array: ' + arr);
+console.log('10 Largest numbers: ' + largest);
+console.log('Average value: ' + avg);
+
+function getAvg(arr) {
+ return arr.reduce((a, b) => a + b) / arr.length;
+}
+
+function getLargest(arr) {
+ return arr.sort((a, b) => b - a).slice(0, 10);
+}
+
+function createArray(min, max) {
+ const arr = [];
+ let number;
+ for (let i = 0; i < 20; i++) {
+ number = Math.round(Math.random() * (max - min)) + min;
+ arr.push(number);
+ }
+ return arr;
+}
diff --git a/04/index.html b/04/index.html
index 06aebbb8..a60cee02 100644
--- a/04/index.html
+++ b/04/index.html
@@ -1,12 +1,15 @@
+
devmentor.pl - JS BASICS - #04
+
-
+
+
\ No newline at end of file
diff --git a/05/app.js b/05/app.js
new file mode 100644
index 00000000..15312bb3
--- /dev/null
+++ b/05/app.js
@@ -0,0 +1,38 @@
+function Student(firstName, lastName) {
+ this.firstName = firstName;
+ this.lastName = lastName;
+ this.grades = {};
+}
+
+Student.prototype.addGrade = function (subject, grade) {
+ if (typeof this.grades[subject] === 'undefined') {
+ this.grades[subject] = [];
+ }
+ this.grades[subject].push(grade);
+};
+
+Student.prototype.getAverageGrade = function (subject = null) {
+ let gradesArr;
+ if (subject !== null) {
+ gradesArr = this.grades[subject];
+ } else {
+ gradesArr = Object.values(this.grades).flat();
+ }
+
+ return (
+ gradesArr.reduce((acc, curr) => acc + curr, 0) / gradesArr.length
+ ).toFixed(2);
+};
+
+const artur = new Student('Artur', 'Testowy');
+
+artur.addGrade('maths', 5);
+artur.addGrade('maths', 5);
+artur.addGrade('maths', 4);
+artur.addGrade('maths', 4);
+artur.addGrade('physics', 4);
+artur.addGrade('physics', 3);
+artur.addGrade('physics', 5);
+
+console.log(artur.getAverageGrade('maths'));
+console.log(artur.getAverageGrade());
diff --git a/05/index.html b/05/index.html
index 52a42709..d58fc56c 100644
--- a/05/index.html
+++ b/05/index.html
@@ -1,12 +1,15 @@
+
devmentor.pl - JS BASICS - #05
+
-
+
+
\ No newline at end of file