作者:xie392地址:https://v.douyin.com/ieaXLmWG/更新时间:2024-12-21
1function isOdd(num) {2return num % 2 === 1 || num % 2 === -1;3}4console.log(isOdd(3)); // true5console.log(isOdd(-1)); // true6console.log(isOdd(1.5)); // false
输出结果:
1true2true3false