diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-regular-expressions-by-building-a-spam-filter/641cdf57c3f7ee276e1d9b32.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-regular-expressions-by-building-a-spam-filter/641cdf57c3f7ee276e1d9b32.md index 0b747441227..17b6fb04e8c 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-regular-expressions-by-building-a-spam-filter/641cdf57c3f7ee276e1d9b32.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-regular-expressions-by-building-a-spam-filter/641cdf57c3f7ee276e1d9b32.md @@ -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.`