How to put the session ID to a JavaScript variable?

Because of some security security reason i cant put as below.

Magento introduce some public , private content and non cacheable to handle customer data but i want customer data in all pages.Magento2 uses knockout.js to bind data for security but i don’t want to bind data with any div.
Is there any specific method available in magento2.

Use cookies or HTML5 local storage.