Skip to content

functions exercises#130

Open
Sebpie0203 wants to merge 4 commits intodevmentor-pl:masterfrom
Sebpie0203:master
Open

functions exercises#130
Sebpie0203 wants to merge 4 commits intodevmentor-pl:masterfrom
Sebpie0203:master

Conversation

@Sebpie0203
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown
Owner

@devmentor-pl devmentor-pl left a comment

Choose a reason for hiding this comment

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

Sebastianie,

Zostawiłem kilka podpowiedzi :)

console.log(time);
}

showTime();
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.

👍

02/app.js Outdated
@@ -0,0 +1,5 @@
function sayHello(name) {
name = "devmentor.pl!";
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.

Tutaj jest błąd sam parametr przyjmuje jakaś wartość - nie należy go nadpisywać. Ta linia jest niepotrzebna.

02/app.js Outdated
name = "devmentor.pl!";
console.log(`czesc ${name}`);
}
sayHello(name);
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.

Dopiero tutaj definiujemy wartość dla parametru - powinno być sayHello("devmentor.pl") w takiej sytuacji niejawnie mamy przypisanie tj. name = "devmentor.pl"

03/app.js Outdated
@@ -0,0 +1,3 @@
function () {
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.

Czyli zaczynamy od czegoś takiego const sum = function() { ... } - reszta jak do tej pory.

04/index.html Outdated
Comment on lines +11 to +12
<script src="../04/scrypt.js"></script>
<script src="./ap.js"></script>
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.

Dlaczego tutaj coś zmieniałeś? Powinno być ./app.js jak w pozostałych. Może był problem ze sposobem uruchomienia live servera?

04/app.js Outdated
Comment on lines +26 to +27
idInterval = setInterval(showCounter, 2000);
stopTime = setInterval(showCounter, 2000);
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.

NIe wiem dlaczego tutaj uruchamiasz 2 razy tą samą funkcję. Zostawmy pierwsze uruchomienie i podmieńmy nazwę funkcji tj.
idInterval = setInterval(runTime, 2000);

04/app.js Outdated
const time = new Date().toLocaleTimeString();
console.log(time);

const showTimeCounter = function () {
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.

Ta funkcje nigdy nie jest uruchamiana więc nie zatrzymasz odliczania, powinno być bez niej tj.

counterTwo++;
if (counterTwo > 5) {
    clearInterval(stopTime);
}

PS. IDE oznacza, że funkcja nie jest uruchamiana:
Screenshot 2024-04-15 at 06 37 43

04/app.js Outdated
const showTimeCounter = function () {
counterTwo++;
if (counterTwo > 5) {
clearInterval(stopTime);
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.

Trzeba jeszcze tylko podmienić odpowiednią nazwę zmiennej: clearInterval(idInterval);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants