Skip to content
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

work on web-calculator #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

wesleyjaboin
Copy link

No description provided.

@@ -46,8 +64,11 @@
<input type="number" class="form-control" name="numberTwo">
</div>
<div>
Copy link
Owner

Choose a reason for hiding this comment

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

This part looks solid.

@@ -13,16 +13,34 @@

<script>
var calculator = {
addNumbers: function () {
addNumbers: function (numberOne, numberTwo) {
Copy link
Owner

Choose a reason for hiding this comment

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

Having the parameters defined on line 16 is not needed. We do not take input into the function. Instead we get the values to work with by taking them from values in the form fields. Lines 18 and 19 for example are getting the values we will use.

},
subtractNumbers: function () {
subtractNumbers: function (numberOne, numberTwo)
Copy link
Owner

Choose a reason for hiding this comment

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

The formatting makes this code look like it needs to be reformatted.
Tabbing, spacing, new lines, indentation, etc are all key to readable code.

You can use the built-in formatting in VS Code.

To use the formatter, go to the View > Command Palette:

Screen Shot 2020-06-16 at 10 23 49 PM

Then choose the "Format Document" option.

Screen Shot 2020-06-16 at 10 24 00 PM

This should make the code have an easier to read formatting. Push that code up as a new commit.

var numberTwo = document.forms.inputs.numberTwo.value;
document.forms.inputs.result.value = parseInt(numberOne) / parseInt(numberTwo);
},

Copy link
Owner

Choose a reason for hiding this comment

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

The code above all looks correct. The formatting is not required for code to work. It is important to learn for readability by you and others.

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