How to merge two arrays in Angular? : <p>According to <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat" rel="nofollow">JS documentation</a> there a concat() method for concatenating arrays, but if I try it in angular:</p>

<pre><code>$scope.array1 = [];
$scope.array2 = [];

$scope.myConcatenatedData = array1 .concat(array2);
</code></pre>

<p>I got an error: <code>ReferenceError: array1 is not defined</code> because I don't use var in declaring arrays. </p>
