Ive got 10 html elements. I need value attributes from 8 and classes from 2 elements and put them all to one array. Id is the key.

How to solve this with JS or jQuery?

I started with `.each()` but I discovered quicky that I can't use exceptions in that loop - it makes the changes for all the elements.

```
var myArray = {};

$( '.need-values, .need-classes' ).each( function () {

    myArray[this.id] = $( this ).val();
});

```

I know that I could use 2 `.each()` loops and combine values to one array but the thing is that some are checkboxes - I need to use `if` statement in loop.