javascript - Underscore Js zip method -


we need merge 2 arrays each other , new array. doing have used underscore js zip method. method not merge null values. in new array need null values. how merge null values?

var = [],    b = [];    a.push(2, 5, 4, null, 4, 8, 7, null, 2, 5, 7);  b.push(12, 15, 14, null, 4, 8, null, 8, 2, 5, 7);    var c = _.zip(a, b);  window.alert(c);
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js"></script>

null never considered value, not problem of underscore js. characteristic of javascript itself. (not js, holds same languages) hence empty value. try using alert(a) i.e variable a, same result. if u explicitly need null on alert(), give string value :"null". hope helps.


Comments