Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to initialize Firebase in a web app.
Firebase
const app = initializeApp([1]); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a wrong variable name that does not hold config data.
✗ Incorrect
The firebaseConfig object contains the necessary keys to connect your app to Firebase services.
2fill in blank
mediumComplete the code to import Firebase Authentication module.
Firebase
import { [1] } from 'firebase/auth';
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Importing Firestore or Storage modules instead of Auth.
✗ Incorrect
getAuth is the function to access Firebase Authentication features.
3fill in blank
hardFix the error in this Firebase initialization code snippet.
Firebase
const app = initializeApp([1]); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Adding parentheses after the config object causing runtime errors.
✗ Incorrect
The firebaseConfig is an object, not a function, so it should not have parentheses.
4fill in blank
hardFill both blanks to correctly import and initialize Firestore in a Firebase app.
Firebase
import { [1] } from 'firebase/firestore'; const db = [2](app);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing Firestore with Auth or using wrong function names.
✗ Incorrect
getFirestore is imported and then called with the app instance to initialize Firestore.
5fill in blank
hardFill all three blanks to set up Firebase Storage and upload a file.
Firebase
import { [1] } from 'firebase/storage'; const storage = [2](app); const storageRef = ref(storage, [3]);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong import names or incorrect file path strings.
✗ Incorrect
Use getStorage to import and initialize storage. The reference path is the file name as a string.