mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-06-22 21:08:12 +08:00
fix(curriculum): update description for step 5 of spam filter project (#53975)
This commit is contained in:
parent
e9f0fe6bfa
commit
f6e32bf9f7
@ -7,7 +7,13 @@ dashedName: step-5
|
||||
|
||||
# --description--
|
||||
|
||||
Back in your event listener, you need to update the text of the `result` element.
|
||||
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.`
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user