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

Add hint to remember this keyword for step 48 of shopping cart project #54602

Closed
juancaorg opened this issue May 2, 2024 · 2 comments · Fixed by #54653
Closed

Add hint to remember this keyword for step 48 of shopping cart project #54602

juancaorg opened this issue May 2, 2024 · 2 comments · Fixed by #54653
Labels
first timers only Open for anyone doing contributions for first time. You do not need permission to work on these. new javascript course These are for issues dealing with the new JS curriculum scope: curriculum Lessons, Challenges, Projects and other Curricular Content in curriculum directory. type: bug Issues that need priority attention. Platform, Curriculum tests (if broken completely), etc.

Comments

@juancaorg
Copy link
Contributor

Describe the Issue

When working through the Shopping Cart Step 48, mentions the following:

Declare a variable tax and assign it the value of calling your new .calculateTaxes() method, passing subTotal as the argument.

And when passing the following solution:

calculateTotal() {
  const subTotal = this.items.reduce((total, item) => total + item.price, 0);
  const tax = calculateTaxes(subTotal);
}

This hint shows up:

Assign the value of calling your new .calculateTaxes() method, passing subTotal as the argument, to the tax variable.

This doesn't pass because is expecting the following:

calculateTotal() {
  const subTotal = this.items.reduce((total, item) => total + item.price, 0);
  const tax = this.calculateTaxes(subTotal);
}

I think adding the hint "Remember to use the this keyword." is a valid hint, just like in step 49 when the this keyword is not added in the solution.

It may be repetitive, but I think the user should be informed for this possible mistake. It's already in other steps anyway.

Affected Page

https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures-v8/learn-basic-oop-by-building-a-shopping-cart/step-48

Your code

calculateTotal() {
  const subTotal = this.items.reduce((total, item) => total + item.price, 0);
  const tax = calculateTaxes(subTotal);
}

Expected behavior

When passing the incorrect code from the above, add the "Remember to use the this keyword." hint and validation.

Screenshots

No response

System

  • Device: Laptop
  • OS: macOS 13.6.6
  • Browser: Chrome
  • Version: 124

Additional context

No response

@juancaorg juancaorg added scope: curriculum Lessons, Challenges, Projects and other Curricular Content in curriculum directory. status: waiting triage This issue needs help from moderators and users to reproduce and confirm its validity and fix. type: bug Issues that need priority attention. Platform, Curriculum tests (if broken completely), etc. labels May 2, 2024
@juancaorg juancaorg changed the title [JS Curriculum] Shopping Cart Step 48 missing this hint. [JS Curriculum] Shopping Cart Step 48 missing this hint May 2, 2024
@jdwilkin4 jdwilkin4 added the new javascript course These are for issues dealing with the new JS curriculum label May 2, 2024
@jdwilkin4 jdwilkin4 changed the title [JS Curriculum] Shopping Cart Step 48 missing this hint Add hint to remember this keyword for step 48 of shopping cart project May 2, 2024
@jdwilkin4
Copy link
Contributor

We can open this up to first timers only since this is a small change

This has been opened for contribution. The first comprehensive PR created will be reviewed and merged. We typically do not assign issues to anyone other than long-time contributors.

If you would like to contribute and have not read the contributors docs, please do so here: https://contribute.freecodecamp.org/#/

If you have any issues with contributing, be sure to join us on the contributors channel, or on the contributors sub-forum

Files that need to be changed

https://github.com/freeCodeCamp/freeCodeCamp/blob/main/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-oop-by-building-a-shopping-cart/63f03686c5ea863533ec71f4.md

changes that need to be made

Change the last hint to be the following

Assign the value of calling your new `.calculateTaxes()` method, passing `subTotal` as the argument, to the `tax` variable. Remember to use the `this` keyword.

Happy coding

@jdwilkin4 jdwilkin4 added first timers only Open for anyone doing contributions for first time. You do not need permission to work on these. and removed status: waiting triage This issue needs help from moderators and users to reproduce and confirm its validity and fix. labels May 2, 2024
@MrGliff
Copy link
Contributor

MrGliff commented May 4, 2024

I can do it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
first timers only Open for anyone doing contributions for first time. You do not need permission to work on these. new javascript course These are for issues dealing with the new JS curriculum scope: curriculum Lessons, Challenges, Projects and other Curricular Content in curriculum directory. type: bug Issues that need priority attention. Platform, Curriculum tests (if broken completely), etc.
Projects
None yet
3 participants