• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 354
  • Last Modified:

Trying to get cookie array and I get an object expected error

I'm trying to get cookie array and I get an object expected error on line 9
 var l = 0;
If my cookies are "undefined" will this cause this error?

Here is my code:
    function getCookieArray(Thumbc)
    var i = 0;
        while (getCookie(Thumbc + i) != null) {
        this[i + 1] = getCookie(Thumbc + i);
        i++; this.length = i;
    function getCookieArray(Titlec){
    var l = 0;
        while (getCookie(Titlec + l) != null) {
        this[l + 1] = getCookie(Titlec + l);
        l++; this.length = l;
var ThumbArray = new getCookieArray("Thumbc");
var TitleArray = new getCookieArray("Titlec");

1 Solution
You are missing a brace "{"

function getCookieArray(Thumbc){
I f gops1's comment doesn't giv solution to u. Then may be if u want u can try this javascript cookie class .

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now