Insert more values inside a variable [closed]

-1
            var $e = $(e.currentTarget);
            var eData = $e.data();

            var personagem = this.model.get('personagens').get({'id': eData.personagemId});

            var candidatos = personagem.get('candidatos');

I need to put another attribute of the character backbonemodel within the variable candidates without changing the values that are already there, I already tried to use the get again, but it overwrites the values that already exist within the variable, there is some way to insert more a value inside the candidate var without changing the values that are already in it?

    
asked by anonymous 21.08.2014 / 16:11

1 answer

0

From what I understand of your problem you should define your variable candidates as an array!

Here's an explanation of how it works and examples!

link

push method link

push and unshift methods link

    
21.08.2014 / 16:35