Exam B2B-Commerce-Developer Topic 1 Question 44 Discussion

Actual exam question for Salesforce's B2B-Commerce-Developer exam
Question #: 44
Topic #: 1
Which template will correctly display the details message only when areDetailsVisible becomes true given the following code in a Lightning Web Component?

Suggested Answer: C Vote an answer

Explanation
The template that will correctly display the details message only when areDetailsVisible becomes true given the following code in a Lightning Web Component is option C. Option C uses the if:true directive to conditionally render a template block based on the value of areDetailsVisible. If areDetailsVisible is true, the template block inside the <template if:true={areDetailsVisible}> tag will be rendered. Otherwise, it will be skipped. Option A is incorrect because it uses the if:false directive, which does the opposite of if:true. It renders the template block only when areDetailsVisible is false. Option B is incorrect because it uses an invalid syntax for the if directive. The if directive requires a colon (:) after the if keyword, not an equal sign (=). Option D is incorrect because it uses an invalid syntax for the template tag. The template tag requires a closing tag (</template>), not a self-closing tag (<template/>). Salesforce References: Lightning Web Components Developer Guide: Conditional Rendering, Lightning Web Components Developer Guide:
Template Syntax

by jlabie at Feb 12, 2024, 05:40 AM

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
Nick name: Submit Cancel
jlabie
2024-02-12 05:40:36
Selected Answer: A
it's A
upvoted 1 times
...
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

0
0
0
10