I need to call the following function cross
4 times, for all permutations of the x
and y
variable with the values 1 and -1;
my approach:
var p = [-1, 1];
p.forEach(function(x) {
p.forEach(function(y) {
cross(x, y);
});
});
Is there a shorter way of doing this?