JS custom objects in Arrays

  • Started
  • Last post
  • 0 Responses
  • g3kk0k1d

    my JS knowledge is very rusty like my....

    im trying to create an array of custom objects (here is a cut down example of code to give you an idea of what on earth im trying to do)

    // constructor
    function NewsObject(link) {
    this.link = link;
    }

    var n = new Array(5);

    n[0] = new NewsObject("i.com")
    n[1] = new NewsObject("etc.com");

    etc,

    ive read up on Objects but can find nothing about arrays of custom objects, so what am i doing wrong here?