Video 34-2 Handle Random user with nested API data
Looking for Bideshini
Name:
Gender:
Location:
Phone:
Video 34-3 International travel, display country name, capital
Video 34-4 (advanced) Call dynamic API, load dynamic data to display
All Countries
Video 34-6 Display dynamic search result using bootstrap cards
Video 34-7 (advanced) Create dynamic url based on click and display modal
Video 34-8 handle fetch error, use try catch and async await
Video 34-9 Module Summary and home work
The Meals
Modal title
QUIZ
Q1: const bondCode=` I am Fake James bond . My new code is: 00${7+1+2}`
If Fake James gives you the bondCode variable and tells you to find the code in javascript , what will you get?
Ans: 0010
Q2: const data={ result: [ {userName: {title:'Mr.',name:"sakib khan"} } ] }
How would you access "sakib khan" ?
Ans: data.result[0].Name.name
Q3: Which array method will you use to obtain an array containing the cubes of array p? const p=[1,2,3]; const q=p.__?__( n=> Math.pow(n, 3));
Ans: map
Q4: How will you make the url dynamic using the food variable?
const url = `https://www.themealdb.com/api/json/v1/1/search.php?s={food}`
Ans: Use${food} instead of {food}
Q5: How to set image src dynamically?
const path = "https://www.images.com/cat.jpg";
const div= document.createElement('div');
div.innerHTML = ``;
Ans: ${path}
Q6: What is textContent in javascript? ( google it and read the wikipedia page)
Ans: All the text contents of a node and all its decendants
Q7: Which one is not a data type in JSON? ( google it )
Ans: undefined
Q8: How will you dynamically pass the name variable as a parameter to the loadDetail function?
Ans: "`/div onclick="loadDetais(${name})">Biriyani /div`"
Q9: How will you handle the error?
fetch(url)
.then(res=>res.json())
.then(data => console.log(data)
.__?__(error => console.log(error))
Ans: catch
Q10:Which one is a proper output?
const array = { hobbies: ["dancing", "singing", "acting"] };
console.log(JSON.stringify(array));
Ans: {"hobbies":[dancing",singing",acting"]}