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

Update description for step 5 of spam filter project #53973

Closed
jdwilkin4 opened this issue Mar 4, 2024 · 3 comments · Fixed by #53975
Closed

Update description for step 5 of spam filter project #53973

jdwilkin4 opened this issue Mar 4, 2024 · 3 comments · Fixed by #53975
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

@jdwilkin4
Copy link
Contributor

Describe the Issue

We need to show the proper syntax for assiging the result of a ternary operator to a variable's text content as mentioned in this forum post.

Let's go with this updated description

Back in your event listener, you need to update the text of the `result` element. You can use a `ternary` operator to achieve this task.

Here is an example of assigning the result of a ternary operator to an element's text content:

```js
el.textContent = condition ? "Use this text if the condition is true" : "Use this text if the condition is false";
```

After the `if` statement, use a ternary operator to check the truthiness of calling `isSpam()` with `messageInput.value` as the argument. If true, set the `textContent` property on the `result` element to `Oh no! This looks like a spam message.`. Otherwise, set it to `This message does not seem to contain any spam.`

Then set the `messageInput` element's `value` property to an empty string.

Affected Page

https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures-v8/learn-regular-expressions-by-building-a-spam-filter/step-5

Your code

see explanation above

Expected behavior

see explanation above

Screenshots

No response

System

  • Device: [e.g. iPhone 6, Laptop]
  • OS: [e.g. iOS 14, Windows 10, Ubuntu 20.04]
  • Browser: [e.g. Chrome, Safari]
  • Version: [e.g. 22]

Additional context

No response

@jdwilkin4 jdwilkin4 added type: bug Issues that need priority attention. Platform, Curriculum tests (if broken completely), etc. scope: curriculum Lessons, Challenges, Projects and other Curricular Content in curriculum directory. 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 labels Mar 4, 2024
@jdwilkin4
Copy link
Contributor Author

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-regular-expressions-by-building-a-spam-filter/641cdf57c3f7ee276e1d9b32.md

Happy coding

@lasjorg
Copy link
Contributor

lasjorg commented Mar 4, 2024

I guess I'm fine with being this explicit about it and showing an example.

But I would hope by now in the curriculum (this challenge is far in) we have promoted the proper usage of the ternary so that it might be handled just in the assert hints.

Also, the hint in the assert for the code posted on the forum isn't super helpful in guiding the camper to the desired syntax.

@jdwilkin4
Copy link
Contributor Author

I am not sure how the assert messages would be updated here to show the syntax. Unless we just give them the answer here.

I am open to ideas for changes

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
Development

Successfully merging a pull request may close this issue.

2 participants