From a0e18f4450d788785d75633bb45279ed33f8ceaf Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 10 Mar 2020 10:03:50 +0100 Subject: [PATCH] LibJS: Oops, non-zero values should boolify to true, not false --- Libraries/LibJS/Value.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libraries/LibJS/Value.cpp b/Libraries/LibJS/Value.cpp index 30ce077737..c29b95943b 100644 --- a/Libraries/LibJS/Value.cpp +++ b/Libraries/LibJS/Value.cpp @@ -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;