Skip to content
Open
Show file tree
Hide file tree
Changes from all 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 @@
function showTime() {
const time = (new Date()).toLocaleTimeString();

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.

👍

7 changes: 7 additions & 0 deletions 02/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function sayHello() {
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 bardziej chodziło, aby zdefiniować parametr np. function sayHello(name) { następnie przy wywołaniu podać odpowiednią wartość tj. sayHello('Mateusz')

PS. Jeśli chcesz dać możliwość wpisania imienia to wtedy można zrobić tak:

const userName = prompt('podaj imie');
sayHello(userName)

let name = (prompt('podaj imie'))

console.log ('Cześć', name + '!' )
}

sayHello(name)
12 changes: 12 additions & 0 deletions 03/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const sumToNumber = function(x) {
let result = 0;
for(let i=1; i <= x; i++) {
result = result + i;

}
return result

}

const res = sumToNumber(4)
console.log(res)
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.

👍

17 changes: 17 additions & 0 deletions 04/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
function runTimer() {
console.log('start');
let iteration = 0;
const idInterval = setInterval(function() {
const time = (new Date()).toLocaleTimeString();
console.log(time);

iteration ++;
console.log (iteration);

if(iteration === 5) {
clearInterval(idInterval)
}
}, 1000)
}

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.

👍