Question: Why am I getting this error?

```
jQuery(document).ready(function($){

  $('.stuff').each(function(){

    function thing(id, count){
      this.id = id;      
      this.count = count;
    }

    var myvar = new Array();
    myvar.push(new thing('one', '134'));
    myvar.push(new thing('two', '225'));

    $('a', this).click(function(event){
       var i = $(this).attr('class'); // class is 'one', 'two' etc...
       // myvar[i] appears undefined here! wtf?

    });    
  });  

});

```

Answer: 
You're trying to access an index based (0,1,2) array with a string index (i, the result of attr('class')).

Easiest fix is to use an object (aka fake hash array) for myvar and set the keys to the class names.

```
var myvar = {
  one : 134,
  two : 225
};

```

With that myvar, you can still use myvar[i] with i being the string index (one, two...)
As i said , your value i might be wrong ,

it should start with 0,1,2 et .... print the value or alert and check it

```
$('a', this).click(function(event){
       var i = $(this).attr('class'); // class is 'one', 'two' etc...
       // myvar[i] appears undefined here! wtf?

    });    

```