GIAC
GPEN · Question #401
GPEN Question #401: Real Exam Question with Answer & Explanation
The correct answer is C. Document cookie. JavaScript accesses and manipulates browser cookies through the document.cookie property exposed by the Document Object Model.
Question
Which of the following is the JavaScript variable used to store a cookie?
Options
- ABrowsercookie
- BWindowcookie
- CDocument cookie
- DSession cookie
Explanation
JavaScript accesses and manipulates browser cookies through the document.cookie property exposed by the Document Object Model.
Common mistakes.
- A. Browsercookie is not a valid property, object, or interface in any JavaScript specification or browser Web API.
- B. Windowcookie is not a property of the window object or any other JavaScript built-in - it does not exist in the Web API.
- D. Session cookie describes a category of cookie (one with no expiry date, deleted when the browser session ends), not a JavaScript variable or property used to access or store cookies.
Concept tested. JavaScript document.cookie DOM property for cookies
Reference. https://developer.mozilla.org/en-US/docs/Web/API/Document/cookie
Community Discussion
No community discussion yet for this question.