nerdexam
Salesforce

PDII · Question #343

A developer is building a Lightning web component that displays quantity, unit price, and the total for an order line item. The total is calculated dynamically as the quantity multiplied by the unit…

The correct answer is B. Add get total() { return quantity * unitPrice; } to the JavaScript and Total: {total} in the template. See the full explanation below for the reasoning.

Question

A developer is building a Lightning web component that displays quantity, unit price, and the total for an order line item. The total is calculated dynamically as the quantity multiplied by the unit price. What must be added to display the total?

Exhibit

PDII question #343 exhibit

Options

  • AAdd calculateTotal() { return quantity * unitPrice; } to the JavaScript and Total: {calculateTotal()}in
  • BAdd get total() { return quantity * unitPrice; } to the JavaScript and Total: {total} in the template.
  • CAdd Total: {multiply{quantity, unitPrice}} in the template.
  • DAdd Total: {quantity * unitPrice} in the template.

How the community answered

(21 responses)
  • A
    14% (3)
  • B
    76% (16)
  • D
    10% (2)

Community Discussion

No community discussion yet for this question.

Full PDII Practice