0
0
Firebasecloud~10 mins

Firebase services overview - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to initialize Firebase in a web app.

Firebase
const app = initializeApp({ apiKey: [1] });
Drag options to blanks, or click blank then click option'
A"your-api-key"
BapiKey
CfirebaseConfig
Dconfig
Attempts:
3 left
💡 Hint
Common Mistakes
Using the variable name instead of the string value
Leaving the key empty
2fill in blank
medium

Complete the code to get a Firestore database instance.

Firebase
const db = get[1]();
Drag options to blanks, or click blank then click option'
AAuth
BFirestore
CStorage
DFunctions
Attempts:
3 left
💡 Hint
Common Mistakes
Using getStorage() or getAuth() instead
3fill in blank
hard

Fix the error in this Firebase Authentication code snippet.

Firebase
const user = [1].currentUser;
Drag options to blanks, or click blank then click option'
Aauth
Bfirebase.auth().currentUser
Cfirebase.auth
Dfirebase.auth()
Attempts:
3 left
💡 Hint
Common Mistakes
Calling firebase.auth() multiple times
Using firebase.auth without parentheses
4fill in blank
hard

Fill both blanks to correctly upload a file to Firebase Storage.

Firebase
const storage = get[1]();
const storageRef = ref(storage, [2]);
Drag options to blanks, or click blank then click option'
AStorage
B"images/photo.jpg"
C"/images/photo.jpg"
DFirestore
Attempts:
3 left
💡 Hint
Common Mistakes
Using Firestore instead of Storage
Including a leading slash in the path
5fill in blank
hard

Fill all three blanks to query Firestore documents where age is greater than 18.

Firebase
const q = query(collection(db, [1]), where([2], [3], 18));
Drag options to blanks, or click blank then click option'
A"users"
B"age"
C">"
D"18"
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong collection name
Using "18" as a string instead of number
Using wrong comparison operator