Duration and delay must be numbers, not strings. Here, duration is a string '1000'.
Step 2: Validate other options
Delay can be any number >= 0; fade accepts parameters; no parentheses needed.
Final Answer:
Duration should be a number, not a string -> Option B
Quick Check:
Use numbers for duration and delay [OK]
Hint: Use numbers, not strings, for duration and delay [OK]
Common Mistakes:
Putting numbers in quotes
Assuming delay minimum is 500
Adding unnecessary parentheses
5. You want a Svelte element to fade in with a 2-second animation but only start after 1 second delay. Which code correctly achieves this?
hard
A. <div transition:fade={{ duration: 2000, delay: 1000 }}>Content</div>
B. <div transition:fade={{ delay: 2000, duration: 1000 }}>Content</div>
C. <div transition:fade={{ duration: '2000', delay: '1000' }}>Content</div>
D. <div transition:fade={{ duration: 1000 }} delay=2000>Content</div>
Solution
Step 1: Match duration and delay values
Duration should be 2000ms (2 seconds), delay should be 1000ms (1 second).
Step 2: Check syntax correctness
<div transition:fade={{ duration: 2000, delay: 1000 }}>Content</div> uses correct syntax with numbers and proper object format.
Step 3: Identify errors in other options
Using strings like '2000' and '1000' for duration and delay is incorrect (must be numbers); swapping to {{ delay: 2000, duration: 1000 }} is wrong; placing delay=2000 outside the transition directive is invalid.
Final Answer:
<div transition:fade={{ duration: 2000, delay: 1000 }}>Content</div> -> Option A
Quick Check:
Correct values and syntax for delay and duration [OK]
Hint: Duration = animation length; delay = wait time before start [OK]
Common Mistakes:
Swapping delay and duration values
Using strings instead of numbers
Placing delay outside transition directive
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.