Check for false

前端 未结 6 2004
孤城傲影
孤城傲影 2021-02-05 02:43

Is there any better way of doing this?

if(borrar() !== false)
{
    alert(\'tatatata bum bum bum prapra\');
}
return false;
6条回答
  •  闹比i
    闹比i (楼主)
    2021-02-05 03:27

    If you want an explicit check against false (and not undefined, null and others which I assume as you are using !== instead of !=) then yes, you have to use that.

    Also, this is the same in a slightly smaller footprint:

    if(borrar() !== !1)
    

提交回复
热议问题