var myArray = [1, 2, 3, 4, 5];
var targetValue1 = 2;
var targetValue2 = 4;
var result = hasTwoValues(myArray, targetValue1, targetValue2);
if (result) {
console.log("数组中存在指定的两个值");
} else {
console.log("数组中不存在指定的两个值");
}
function hasTwoValues(array, value1, value2) {
return array.includes(value1) && array.includes(value2);
}