The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Tryint to create the index of a constructor

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #36956
    function Category(year, min, max) {
    this.count = year;
    this.min = min;
    this.max = max;
    var mazda = new Category(1995, 0, 12),
    honda = new Category(1998, 0, 14);

    What’d i’d like is to be able to call an index of Category. So Category[0] could yield (1995,0,12). Any ideas?


    Thanks so much for your speedy reply. I think that might help, but I should have explained in more detail. I’m trying to make this bit of code more flexible. I’ve set up a div with two buttons and a span holding counter.

    What’d I’d like to do is have the javascript flexible enough, that no matter how many button counter structures one add, the javascript could identify which button was clicked and the count up or down and update the span.

    *Oh and so that each button/counter structure could have it’s own set of min/max values where one the value is reached the button is disabled

    You can see how I’ve set it up currently at:

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.