window & document
Në shqip: Objektet window dhe document
ShpjegimiSQ
Në shfletues, window është objekti më i madh: dritarja me gjithçka brenda — location (adresa), localStorage, alert(), setTimeout(). document është faqja HTML brenda saj, nga ku i kap elementet. Në Node.js, këto s'ekzistojnë.
EnglishEN
In the browser, window is the biggest object: the whole window with everything in it — location (the address), localStorage, alert(), setTimeout(). document is the HTML page inside it, where you grab elements from. In Node.js, these don't exist.
Si ta mendosh
window është gjithë shtëpia; document është dhoma ku ndodhet faqja jote.
Lexoje në anglisht
window is the whole house; document is the room your page lives in.
Shembull kodijavascript
console.log(window.location.pathname); // "/term/api"
window.innerWidth; // gjerësia e dritares
document.title = "Titull i ri";