Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions 01/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const time = new Date().toLocaleTimeString();
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uważaj na miejsce "deklaracji" takiej zmiennej. To zadanie jest ok, ale jeśli np. funkcja showCurrentTime będzie uruchamiana dopiero po kliknięciu np. w button. To czas jaki zostanie pokazany to nie moment kliknięcie w button. Tylko moment załadowania strony (wtedy zapisujesz czas do zmiennej). Jeśli pobierzesz czas wew. funkcji to będzie bardziej elastyczne rozwiązanie (czas zostanie pobrany w momencie uruchomienia funkcji).

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@devmentor-pl W zadaniu 04 poprawiłam podobny błąd, ale już nie wróciłam do zadania 01. Teraz już poprawiłam, będę o tym pamiętać!


function showCurrentTime() {
console.log(time);
}

showCurrentTime();
4 changes: 4 additions & 0 deletions 02/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
function sayHello(firstName) {
console.log(`Cześć ${firstName}!`);
}
sayHello("Natalia");
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

9 changes: 9 additions & 0 deletions 03/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const sumNumbers = function (maxNumber) {
let sum = 0;
for (let i = 1; i <= maxNumber; i++) {
sum = sum + i;
}
return sum;
};

console.log(sumNumbers(5));
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

12 changes: 12 additions & 0 deletions 04/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const runTimer = function () {
let counter = 0;
let timerId = setInterval(function () {
const time = new Date().toLocaleTimeString();
console.log(time);
counter++;
if (counter >= 5) {
clearInterval(timerId);
}
}, 5000);
};
runTimer();
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍