Homework 4#3
Open
Phantom123-cloud wants to merge 12 commits into
Open
Conversation
cos1715
reviewed
Mar 25, 2024
|
|
||
| if (isNaN(promptValue)) { | ||
| alert('Ви ввели не число!') | ||
| } |
There was a problem hiding this comment.
I suggest wrapping all block in this if or use else
if (isNaN(number)) { alert("Not a number"); } else { if (number % 2 === 0) { alert("even"); } else { alert("odd"); } }
| else if (tasksProm === "Ternary") { | ||
| // Ternary | ||
| const male = confirm('Ви чоловік?'); | ||
| male === true ? alert('Ви чоловік') : alert('Ви жінка'); |
There was a problem hiding this comment.
please don't write comparison like this
male is boolean it's enough just male? ....``
| else if (tasksProm === "Prompt") { | ||
|
|
||
| // Prompt: or | ||
| let age = prompt('How old are you?'); |
| //Confirm: if this days | ||
| let shoping = confirm('Шопінг?'); | ||
|
|
||
| if (shoping === false) { |
| else if (tasksProm === "Default (or)") { | ||
|
|
||
| // Default: or | ||
| let surname = prompt('Прізвище?') || "Шевченко"; |
There was a problem hiding this comment.
const
also in new ES standard was introduced operator ??
and ?? suits more for this task
| } | ||
|
|
||
| else { | ||
| alert('Всього найкращого!') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.