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

feat: add decimal to binary converter project #50438

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

scissorsneedfoodtoo
Copy link
Contributor

@scissorsneedfoodtoo scissorsneedfoodtoo commented May 19, 2023

Checklist:

Closes #XXXXX

Edit: Converted to draft to ensure this doesn't get merged before the tests are in. Will open this up for early feedback now that the tests are passing.

@github-actions github-actions bot added platform: learn UI side of the client application that needs familiarity with React, Gatsby etc. scope: curriculum Lessons, Challenges, Projects and other Curricular Content in curriculum directory. scope: i18n language translation/internationalization. Often combined with language type label labels May 19, 2023
@codesee-maps
Copy link
Contributor

codesee-maps bot commented May 19, 2023

👀 Review this PR in a CodeSee Review Map

View the CodeSee Map of this change

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map legend

@scissorsneedfoodtoo scissorsneedfoodtoo marked this pull request as ready for review May 19, 2023 12:55
@scissorsneedfoodtoo scissorsneedfoodtoo requested a review from a team as a code owner May 19, 2023 12:55
@scissorsneedfoodtoo scissorsneedfoodtoo marked this pull request as draft May 19, 2023 15:15
Copy link
Member

@naomi-lgbt naomi-lgbt left a comment

Choose a reason for hiding this comment

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

Hey Kris,

Saw this was reverted back to draft, but thought I'd provide early feedback on the instruction copy.


# --description--

<dfn>Recursion</dfn> is when a function calls itself. A good understanding of what recursion is an when to use it can make solving some problems much easier. For this project, you'll build a decimal to binary converter and use recursion to perform the calculations.
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to define recursion before we teach it?


# --description--

Use the `.getElementById()` method to get the button element with the id `convert` and store it in a variable called `convertBtn`. Then use the same method to get the `h2` element with the id `result` and store it in a variable called `result`.
Copy link
Member

Choose a reason for hiding this comment

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

Should we combine this with the previous step? Campers should be pretty comfortable with selecting a bunch of elements by now.


Remove the `console.log()` statement from the callback function and add an `if` statement that checks if `e.key` is equal to the string `Enter`. Leave the body of your `if` statement empty for now.

Note: Since the `Enter` and `Return` keys have similar functions, they both have the same value of `"Enter"`.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Note: Since the `Enter` and `Return` keys have similar functions, they both have the same value of `"Enter"`.
Note: Since the `Enter` and `Return` keys have similar functions, they both have the same string value of `Enter`.


The `keydown` event fires every time a user presses a key on their keyboard, and is a good way to add more interactivity to `input` elements.

Chain `.addEventListener()` to `numberInput`. Pass the string `keydown` as the first parameter, and pass an empty callback function as the second parameter to `.addEventListener()`.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Chain `.addEventListener()` to `numberInput`. Pass the string `keydown` as the first parameter, and pass an empty callback function as the second parameter to `.addEventListener()`.
Chain `.addEventListener()` to `numberInput`. The event listener should listen for `keydown` events and take an empty callback function.

This is the seventh project where campers use event listeners - do we want to take a more vague but thought provoking wording?


Now that your `checkUserInput()` function is set up for testing, you can use an event listener to call the function when users click the `Convert` button.

Chain the `.addEventListener()` method to `convertBtn`. Pass the string `click` as the first parameter, and pass a reference to the `checkUserInput` function as the second parameter to `.addEventListener()`. Remember that function references are not called with parentheses.
Copy link
Member

Choose a reason for hiding this comment

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

Same as step 6 above.


# --description--

While asynchronous, or <dfn>async</dfn>, code can be difficult to understand at first, it has many advantages. One of the most important is that it allows you to write non-blocking code.
Copy link
Member

Choose a reason for hiding this comment

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

async is technically a reserved keyword in JavaScript. Do we want to define it as a term here? I worry that might get confusing.


# --description--

Next, use string interpolation (`${}`) to set the `id` attribute to the `inputVal` property of the current object, `obj`.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Next, use string interpolation (`${}`) to set the `id` attribute to the `inputVal` property of the current object, `obj`.
Next, use string interpolation to set the `id` attribute to the `inputVal` property of the current object, `obj`.

This is the seventh project using template literals - shouldn't need an example.


# --description--

Add a `class` attribute set equal to `animation-frame`.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Add a `class` attribute set equal to `animation-frame`.
Add a `class` attribute set to `animation-frame`.

decimalToBinary(1) returns "1" (base case) and gives that value to the stack below. Then it pops off the stack.
```

Note that, since the string itself contains double quotation marks, you will need to use single quotation marks for your string value.
Copy link
Member

Choose a reason for hiding this comment

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

They could also use backticks or escape the quotes.

When testing this, probably best to look at the value of the object property:

assert.equal(animationData[2].msg, 'decimalToBinary(1) returns "1" (base case) and gives that value to the stack below. Then it pops off the stack');


# --description--

Next, you'll remove the paragraph elements from the `div#show-animation` element after the delays you specified earlier.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Next, you'll remove the paragraph elements from the `div#show-animation` element after the delays you specified earlier.
Next, you'll remove the paragraph elements from the `#show-animation` element after the delays you specified earlier.

@scissorsneedfoodtoo scissorsneedfoodtoo marked this pull request as ready for review May 21, 2023 08:17
@scissorsneedfoodtoo
Copy link
Contributor Author

Awesome, thank you for your helpful feedback @naomi-lgbt. I'll address all of your review comments ASAP.

@Sembauke Sembauke added the status: waiting update To be applied to PR if a maintainer/reviewer has left a feedback and follow up is needed from OP label Jun 8, 2023
@Sembauke
Copy link
Member

Sembauke commented Aug 2, 2023

Hey @scissorsneedfoodtoo, how's this going :) ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
front 3 2023 platform: learn UI side of the client application that needs familiarity with React, Gatsby etc. scope: curriculum Lessons, Challenges, Projects and other Curricular Content in curriculum directory. scope: i18n language translation/internationalization. Often combined with language type label status: waiting update To be applied to PR if a maintainer/reviewer has left a feedback and follow up is needed from OP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants