I'm trying to combine 2 arrays in javascript into one.
var lines = new Array("a","b","c");
lines = new Array("d","e","f");
This is a quick example, i want to be able to combine them so that when the second line is read the 4th element in the array would return "d"
How would i do this?
This question is related to
javascript
arrays
var a = ['a','b','c'];
var b = ['d','e','f'];
var c = a.concat(b); //c is now an an array with: ['a','b','c','d','e','f']
console.log( c[3] ); //c[3] will be 'd'
Source: Stackoverflow.com