function loveCalculator(flower1, flower2) { if (flower1 % 2 === 0 && flower2 % 2 !== 0) { return true; } else if (flower1 % 2 !== 0 && flower2 % 2 === 0) { return true; } else { return false; } }

// 调用函数进行测试 console.log(loveCalculator(3, 4)); // true console.log(loveCalculator(2, 6)); // false console.log(loveCalculator(1, 5)); // true

JavaScript 爱情计算器:判断蒂米和莎拉是否相爱

原文地址: https://www.cveoy.top/t/topic/mlWC 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录