-2

with console.info(hora); I print the array:

 ["NO HORA", 1, "NO HORA", 1]

and with console.info(self.aEstados.estados); I print the array:

 ["SI CONTIENE", "NO CONTIENE", 2]

But I need the arrays together:

 ["NO HORA", 1, "NO HORA", 1, "SI CONTIENE", "NO CONTIENE", 2] 

How can I do this?

Khalid
  • 4,730
  • 5
  • 27
  • 50
Jeanbf
  • 317
  • 1
  • 5
  • 15

2 Answers2

0

use Array.prototype.concat method:

var result = hora.concat(self.aEstados.estados);
Khalid
  • 4,730
  • 5
  • 27
  • 50
0

Use Array.prototype.concat ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat )

var combined = hora.concat( self.aEstados.estados );
console.info( combined );
Dai
  • 141,631
  • 28
  • 261
  • 374
  • Hi , i have this error : Cannot read property 'concat' of undefined – Jeanbf Jun 18 '15 at 00:20
  • @Jeanbf you need to call `concat` in a function that has both `hora` and `self.aEstados.estados` in-scope. – Dai Jun 18 '15 at 00:26