If I were to run
with no current object, it would return an alert with [object Window]
First we should understand what cookies are, they’re files that a website puts on your hard drive that holds user information such as options checked, text inputted, date data, and many more. When you re-open a website, the website reads that file which is how logins work and why you might find yourself logged out of a website you’ve been logged in for a while, because the file is either deleted or expired. They unfortunately have a downside of slowing down your browser, sending unencrypted data and limited to 4 KB.
Enough about cookies, lets talk about localStorage
localStorage is a native feature on all browsers that stores named key/value pairs on your device, it is similar to cookies in a way but it doesn’t send any data to the server, has a much larger size of 5 MB, and doesn’t impact your browsers performance
addEventListener is a method that attaches an event handler on an EventTarget. The difference between addEventListener and onclick is that addEventListener doesn’t override any existing handlers whereas onclick does, also addEventListener doesn’t work on any Internet Explorer versions before 9, whereas onclick does.