SO Help: jQuery Merge Array Objects

by Dylan Schadeck

HTML

<center>See Console Log</center>

CSS

center { padding: 3em; }

JavaScript

$(function() {
    var json1 = [{id:1, name: 'xxx'}],
        json2 = [{id:2, name: 'xyz'}],
        json3 = [{id:3, name: 'xyy'}],
        json4 = [{id:4, name: 'xzy'}],
        json5 = [{id:5, name: 'zxy'}];
    
    
    $.concat||$.extend({concat:function(b,c){var a=[];for(x in arguments)a=a.concat(arguments[x]);return a}});
    
    console.log($.concat(json1, json2, json3))
    console.log($.concat(json1, json2, json3, json4, json5))
    console.log($.concat(json4, json1, json2, json5))
});