var a = [26, 27, 28, 29];
var ab = [41, 42, 43, 44];
for (i=0; i<a.length; i++) {
for (j=0; j<ab.length; j++) {
var b;
b = ab[j]-a[i];
console.log(b);
}
}
var a = [26, 27, 28, 29];
var ab = [41, 42, 43, 44];
var result = new Array( a.length * ab.length );
for (var i=0; i<a.length; i++) {
for (var j=0; j<ab.length; j++) {
result[ i*a.length + j ] = ab[j]-a[i];
}
}
console.log( result );