A. The ref function is called with wrong arguments.
B. deleteObject should not use promises.
C. Missing await keyword before deleteObject.
D. The file path should not include folders.
Solution
Step 1: Check ref function usage
The ref function requires the storage instance as the first argument, not the string 'storage'.
Step 2: Validate other parts
Using promises with then and catch is valid. Await is optional here. File paths can include folders.
Final Answer:
The ref function is called with wrong arguments. -> Option A
Quick Check:
ref() needs storage instance, not string = A [OK]
Hint: ref() needs storage object, not string 'storage' [OK]
Common Mistakes:
Passing string 'storage' instead of storage object
Thinking await is mandatory with promises
Believing file paths cannot have folders
5. You want to delete multiple files in Firebase Storage: file1.txt, file2.txt, and file3.txt. Which approach correctly deletes all files and logs 'All deleted' only after all deletions succeed?
hard
A. Use Promise.all with deleteObject calls for each file reference.
B. Call deleteObject sequentially without waiting for promises.
C. Use a for loop with deleteObject but no await or Promise.all.
D. Delete only the first file; others delete automatically.
Solution
Step 1: Understand asynchronous deletion
Each deleteObject returns a promise. To wait for all deletions, use Promise.all.
Step 2: Check other options
Sequential calls without waiting may not complete before logging. For loop without await or Promise.all won't wait. Files do not delete automatically.
Final Answer:
Use Promise.all with deleteObject calls for each file reference. -> Option A
Quick Check:
Promise.all waits for all deletes = D [OK]
Hint: Use Promise.all to wait for multiple deletes [OK]
Common Mistakes:
Not waiting for all delete promises
Assuming deleting one file deletes others
Ignoring asynchronous nature of deleteObject
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.