Skip to content

finish js#15

Open
RazBenLulu wants to merge 1 commit into
ColmanDevClubORG:mainfrom
RazBenLulu:feature/js-solution
Open

finish js#15
RazBenLulu wants to merge 1 commit into
ColmanDevClubORG:mainfrom
RazBenLulu:feature/js-solution

Conversation

@RazBenLulu

Copy link
Copy Markdown

No description provided.

@Tamir198 Tamir198 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hey left you some comments

Comment thread script.js
@@ -0,0 +1,96 @@
const number = document.querySelectorAll(".number")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

numbers because its plural

Comment thread script.js

number.forEach(button => {
button.addEventListener('click', function () {
console.log(button.textContent)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Remove the console, its not needed

Comment thread script.js
const op = [add, sub, mul, div]
let operation = ""

op.forEach(button => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

good practice on the array and single event listener

Comment thread script.js
})

eql.addEventListener('click', function () {
if (input === "" && x === "") {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You could extract this check into a function because you have this many times in the code

Comment thread script.js
}

y = input
num1 = Number(x)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Add a check to see that this will not be NAN by accident

Comment thread script.js
}
}

if (sum=="Error"){

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hardcoded strings should be saves inside constant variables

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