SyntaxFix
Write A Post
Hire A Developer
Questions
document.cookie.indexOf('cookie_name=');
It will return -1 if that cookie does not exist.
-1
p.s. Only drawback of it is (as mentioned in comments) that it will mistake if there is cookie set with such name: any_prefix_cookie_name
any_prefix_cookie_name
(Source)