Correct Answer: A
Comprehensive and Detailed Explanation From Exact Extract JavaScript knowledge:
Line 05 uses the conditional (ternary) operator:
condition ? valueIfTrue : valueIfFalse
In this specific code:
account.style.display = accountName.includes(parsedSearchString)
? /* valueIfTrue */
: /* valueIfFalse */;
accountName.includes(parsedSearchString) returns:
true if the accountName string contains the parsedSearchString,
false otherwise.
The requirement is:
Hide accounts that do not match the search string.
That means:
If the account name includes the search string → it should be visible.
If the account name does not include the search string → it should be hidden.
The relevant property is:
account.style.display
For the display property:
Common values for showing elements:
'block', 'inline', 'inline-block', etc.
Common value for hiding elements:
'none' (element is not rendered and takes up no space).
So we want:
When accountName.includes(parsedSearchString) is true → show the element, e.g. display = 'block'.
When false → hide the element, display = 'none'.
Therefore the assignment should be:
account.style.display = accountName.includes(parsedSearchString) ? 'block' : 'none'; This matches option A:
'block' : 'none'
Why other options are incorrect:
B . 'none' : 'block'
This would hide matching accounts and show non-matching accounts, which is the opposite of the requirement.
C . 'hidden' : 'visible'
These are not valid values for the display property; they belong to the visibility property (visibility: 'hidden' | 'visible'), not display.
D . 'visible' : 'hidden'
Same issue as C: not valid for display, and reversed logic compared to requirement.
Thus, to correctly show matching accounts and hide non-matching ones, the ternary must be:
'block' : 'none'
Reference of JavaScript knowledge documents or Study Guide (concept names only):
Conditional (ternary) operator condition ? exprIfTrue : exprIfFalse
String.prototype.includes for substring checks
DOM APIs: document.querySelectorAll and forEach on NodeLists
Element styling via element.style.display
CSS display property: block vs none
________________________________________