我正在处理一段代码,测试总是以-1的形式返回 这是否if语句使后面的部分无法访问?我在想,无论ypos的值是多少,它将始终返回-1?
export function showPreview(content: any , xpos: any, ypos: number, ybot: any) {
if (!(ypos > 100 || ypos < 100 || ypos === 100)) {
return -1;
}
hidePreview();
positionPreview(xpos, ypos, ybot);
return 1;
答案 0 :(得分:1)
也许您交出NaN
或undefined
或仅交出'100'
。
var ypos = '100';
if (!(ypos > 100 || ypos < 100 || ypos === 100)) {
console.log(-1);
}