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
6 changes: 6 additions & 0 deletions 01/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
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.

👍

6 changes: 6 additions & 0 deletions 02/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
function sayHello(name){
console.log('Czesc ' + name + '!')
}

sayHello('Michal');
sayHello('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.

👍

17 changes: 17 additions & 0 deletions 03/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

const fn = function (num) {
let result = 0;
for (let i = 1; i <= num; i++) {
result += i;
// console.log(i);
}
return result
// console.log(result);
}

const sumNumbers = fn(4);

console.log(sumNumbers)

console.log(fn(10), fn(20))
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.

👍


29 changes: 29 additions & 0 deletions 04/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
let idInterval;
let counter = 1;

function runTimer() {
const time = (new Date()).toLocaleTimeString();
console.log(time);
// timeCounter();
// counter++;
// console.log(counter);
// if (counter > 5) {
// console.log('dziala');
// clearInterval(idInterval);
// }
}

idInterval = setInterval(function(){
runTimer();
timeCounter();
}, 1000);
// runTimer();

function timeCounter(){
counter++;
if(counter>5){
clearInterval(idInterval);
}
}
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.

👍