From f6e32bf9f784f9533839fc45287b5d559d7c9cfd Mon Sep 17 00:00:00 2001 From: Supravisor <153783117+Supravisor@users.noreply.github.com> Date: Tue, 5 Mar 2024 21:44:22 +1300 Subject: [PATCH] fix(curriculum): update description for step 5 of spam filter project (#53975) --- .../641cdf57c3f7ee276e1d9b32.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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.`