summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-03-10 10:03:50 +0100
committerAndreas Kling <kling@serenityos.org>2020-03-10 10:08:42 +0100
commita0e18f4450d788785d75633bb45279ed33f8ceaf (patch)
tree1135593e5a54cee28ab11e630eb2fbecd36f66dd
parente9687ee50e3cdd3014f0364c96663b650f5ace63 (diff)
downloadserenity-a0e18f4450d788785d75633bb45279ed33f8ceaf.zip
LibJS: Oops, non-zero values should boolify to true, not false
-rw-r--r--Libraries/LibJS/Value.cpp2
1 files changed, 1 insertions, 1 deletions
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;