-
Notifications
You must be signed in to change notification settings - Fork 172
Function #152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Function #152
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 () | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| function sayHello() { | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TUtaj bardziej chodziło, aby zdefiniować parametr np. PS. Jeśli chcesz dać możliwość wpisania imienia to wtedy można zrobić tak: |
||
| let name = (prompt('podaj imie')) | ||
|
|
||
| console.log ('Cześć', name + '!' ) | ||
| } | ||
|
|
||
| sayHello(name) | ||
| 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) | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
| 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() | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍