Cookies should be used to prevent javascript from accessing session-id values.
What are cookies?
Cookies are brief text messages that a website you visit sends to your browser.
Web browsers are instructed to only send cookies using encryption using the Secure cookie property.
The session ID can be taken from the user's browser cookies during storage, frequently via cross-site scripting. The session ID may be seen while it's being sent by listening in on network traffic.
Keep in mind that every request to the server includes a session ID. Using the cookie attribute of the Document object,
JavaScript is also capable of manipulating cookies. JavaScript has the ability to read, write, change, and remove cookies that are specific to the current web page.
Hence, cookies should be used to prevent javascript from accessing session-id values.
To learn more about the cookies refer to:
https://brainly.com/question/20263903
#SPJ1