function check_product_of_every_pair(array) {
for (let i = 0; i < array.length; i += 2) {
let product = array[i] * array[i + 1];
console.log(array[i] + " * " + array[i + 1] + " = " + product);
if (array.find(e => e === product) == undefined) {
return false;
}
}
return true;
}
const array = [2, 3, 6, 7, 42, 0];
console.log((check_product_of_every_pair(array) ? "Yes" : "No"));
/*
run:
2 * 3 = 6
6 * 7 = 42
42 * 0 = 0
Yes
*/