JavaScript Grew Up and Became a Real Language
medium.com
medium.com
For example, to set Cookies:
document.cookie = "username=John Smith; expires=Thu, 18 Dec 2013 12:00:00 UTC; path=/";
To erase it: document.cookie = "username=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
Getting cookie by key involves splitting string and etc.There must have been some constraint that shaped this API, and I'd love to learn about that constraint.
If I designed an API like this in a tech interview, nobody would hire me.
Will probably be incorporated across browsers at some point.
document.cookies just isn't a huge pain because every framework provides abstraction around it. So not many people are motivated to clean it up.
Also, document.cookie is a runtime environement thing and not nessarily tied to JS.