how to get variable in local storage in javascript

JavaScript
localStorage.getItem('id');
Source

Also in JavaScript: