Join split mutiples in a single variable

0

I'm trying to create a split of several variables

var x = canales.split(',') 
output: (2) ["especialista", "propio"]

but I've tried to add more data to that same split, and try to use:

globArr = []
var x = canales.split(',') 
var y = regiones.split(',')
globArr.push(x)
globArr.push(y)

output:
["especialista", "propio"]
["sur", "centro", "occidente"]

It does not work for me because I want everything in a single array it should be like this:

["especialista", "propio","sur", "centro", "occidente"]

Does anyone know what I can do?

    
asked by DoubleM 18.12.2018 в 23:59
source

1 answer

1

I recommend using the concat function, because it allows you to add elements and arrangements to your arrangement as elements:

var a = ["1", "2", "3"];
var b = ["sur", "centro", "occidente"];
console.log(a.concat(b));
    
answered by 19.12.2018 в 03:33