I have this code below with 3 arrays and sometime the green array will be completely empty how do i make it so that when i combine all my arrays and loop through my foreach it doesn't print undefined value? Any help would be greatly appreciated.
var blue = job['blue-color'];
var red = job['red-color'];
var green = job['green-color'];
var colors = blue .concat(red,green);
var colorbooks = '<div">';
$.each(colors, function (index) {
colorbooks += '<div">' + colors[index] + '</div>';
});
colorbooks+= '</div>';