LibJS: Oops, non-zero values should boolify to true, not false

This commit is contained in:
Andreas Kling 2020-03-10 10:03:50 +01:00
parent e9687ee50e
commit a0e18f4450
Notes: sideshowbarker 2024-07-19 08:47:34 +09:00

View file

@ -59,7 +59,7 @@ bool Value::to_boolean() const
case Type::Boolean:
return m_value.as_bool;
case Type::Number:
return m_value.as_double == 0 || m_value.as_double == -0;
return !(m_value.as_double == 0 || m_value.as_double == -0);
case Type::Null:
case Type::Undefined:
return false;