A scenario: I have a cookie that has been split into an array:
var treats = document.cookie.split(';');
[dogs=bla, cats=sdfgh, cabbages=kjhgfdfg]
If I aim to locate the index of 'cats=sdfgh', I can utilize
treats.indexOf('cats=sdfgh');
1
However, if my goal is to determine whether the value of cats has been set, how do I go about it? Would treats.indexOf(find('cat='));
or a similar approach work?
Hence, minus knowledge of the cats' value, how do I ascertain its existence in the cookie?
Additionally, what's the technique to acquire the index number of that specific cookie?