Professional Documents
Culture Documents
Scope >>>
any variable in js are global expect the function Scope
Hoisting >>> the important thing it make the initialization of variables and
functions Up.
Callback Function
fetch
blockscope > means if.. for.. while.. switch (if we use var it will be global
variable but if we use let it's will be local)
Js api
myHttp.send();
var myPosts = [];
myHttp.addEventListener("readystatechange", function () {
if (myHttp.status == 200 && myHttp.readyState == 4) {
myPosts = JSON.parse(myHttp.response).results;
console.log(myPosts);
displayData();
}
});
(((((((((((
بدل كل الظيطه اللي فوق ديييييييييي
))))))))))))
function displayData() {
var cartona = ``;
for (var i = 0; i < myPosts.length; i++) {
cartona += `
<div class="col-md-4">
<img src="https://www.themoviedb.org/t/p/w220_and_h330_face$
{myPosts[i].poster_path}" class="w-100 h-50">
<h1>${myPosts[i].title == null ? 'person': `${myPosts[i].title}`}
</h1>
<p>${myPosts[i].overview== null? 'that what i need':`$
{myPosts[i].overview}`} </p>
</div>
`;
}
document.getElementById("post").innerHTML += cartona;
}
///////////////////////////////////////////