Skip to content

Homework 4#3

Open
Phantom123-cloud wants to merge 12 commits into
masterfrom
homework-4
Open

Homework 4#3
Phantom123-cloud wants to merge 12 commits into
masterfrom
homework-4

Conversation

@Phantom123-cloud
Copy link
Copy Markdown
Owner

No description provided.

Comment thread 04/script.js

if (isNaN(promptValue)) {
alert('Ви ввели не число!')
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"); } }

Comment thread 04/script.js
else if (tasksProm === "Ternary") {
// Ternary
const male = confirm('Ви чоловік?');
male === true ? alert('Ви чоловік') : alert('Ви жінка');
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please don't write comparison like this
male is boolean it's enough just male? ....``

Comment thread 04/script.js
else if (tasksProm === "Prompt") {

// Prompt: or
let age = prompt('How old are you?');
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why let

Comment thread 04/script.js
//Confirm: if this days
let shoping = confirm('Шопінг?');

if (shoping === false) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if(!shoping)

Comment thread 04/script.js
else if (tasksProm === "Default (or)") {

// Default: or
let surname = prompt('Прізвище?') || "Шевченко";
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const
also in new ES standard was introduced operator ??
and ?? suits more for this task

Comment thread 04/script.js
}

else {
alert('Всього найкращого!')
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🫡

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants