LearnFrenzy
Sign in Take a free test

Operators · JavaScript Operators MCQ · Question 8

null >= 0 vs null == 0 Answer, explanation & discussion

  • MCQ
  • Hard
  • 0 comments
  • Answer explained
  • Moderated community
Question 8 Back to Exercise

Why is null >= 0 true while null == 0 is false?

  • A Because null is greater than 0
  • B It is an engine bug that differs between browsers
  • C >= compares types and == compares values
  • D Relational operators convert null to 0, but == has a special rule: null is loosely equal only to undefined Correct
Correct Answer: Option D

null >= 0 becomes 0 >= 0, which is true. The loose-equality algorithm never converts null to a number; it is equal to null and undefined only.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links