-
Notifications
You must be signed in to change notification settings - Fork 0
Completly exercises #1
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: main
Are you sure you want to change the base?
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,19 @@ | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| <title>03_JavaScript-foundations__loops-conditionals</title> | ||
| <script src="/loops-conditionals/conditionals/exercise_00.js" defer></script> | ||
| <script src="/loops-conditionals/conditionals/exercise_01.js" defer></script> | ||
| <script src="/loops-conditionals/conditionals/exercise_02.js" defer></script> | ||
| <script src="/loops-conditionals/loops/exercise_00.js" defer></script> | ||
| <script src="/loops-conditionals/loops/exercise_01.js" defer></script> | ||
| <script src="/loops-conditionals/loops/exercise_02.js" defer></script> | ||
| <script src="/loops-conditionals/while/exercise_00.js" defer></script> | ||
| <script src="/loops-conditionals/while/exercise_01.js" defer></script> | ||
| <script src="/loops-conditionals/while/exercise_02.js" defer></script> | ||
| </head> | ||
| <body> | ||
| </body> | ||
| </html> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,3 +6,14 @@ | |
| * If it is greater than or equal to 5, print "Logged In with (number)!" | ||
| * If it is less than 5, print "Logged Out with (number)!" | ||
| */ | ||
|
|
||
| for (let i = 1; i <= 10; i++) { | ||
|
|
||
| let number = (Math.random() * 10) | 0 + 1; | ||
|
Collaborator
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. Can you explain this expression? 🤔 |
||
|
|
||
| if (number >= 5) { | ||
| console.log(`Logged In with (${number})!`); | ||
| } else { | ||
| console.log(`Logged Out with (${number})!`); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,3 +18,19 @@ | |
| You made it! | ||
| All done! | ||
| */ | ||
|
|
||
| for (let i = 1; i <= 100; i++) { | ||
|
Collaborator
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. This implementation is not compliant with requirements. |
||
| if (i % 10 === 0) { | ||
| console.log(`Checkpoint! ${i}`); | ||
| } | ||
|
|
||
| if (i === 50) { | ||
| console.log("Halfway there!"); | ||
| } | ||
|
|
||
| if (i === 100) { | ||
| console.log("You made it!"); | ||
| } | ||
| } | ||
|
|
||
| console.log("All done!"); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,3 +18,17 @@ | |
| You made it! | ||
| All done! | ||
| */ | ||
|
|
||
| $counter = 1; | ||
|
|
||
| while ($counter <= 100) { | ||
|
Collaborator
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. This implementation is not compliant with requirements. |
||
|
|
||
| if ($counter % 10 == 0) { | ||
| echo "Checkpoint! $counter\n"; | ||
| } | ||
|
|
||
| if ($counter == 50) { | ||
| echo "Halfwy there!\n"; | ||
| } | ||
|
|
||
|
|
||
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.
Good solution.
Take in account object calisthenics rules in the future 👉 avoid
elsestatement.https://medium.com/@davidsen/clean-code-object-calisthenics-f6f4dec07c8b