Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7961379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:01:01+00:00 2026-06-04T05:01:01+00:00

The == operator is really funny. It is usually doesn’t behave as one think

  • 0

The == operator is really funny. It is usually doesn’t behave as one think it will.

This led me to investigate exactly what is happening below the tip of the iceberg, and according to MDN it is as follow:

If the two operands are not of the same type, JavaScript converts the
operands then applies strict comparison. If either operand is a number
or a boolean, the operands are converted to numbers if possible; else
if either operand is a string, the other operand is converted to a
string if possible. If both operands are objects, then JavaScript
compares internal references which are equal when operands refer to
the same object in memory.

(source)

So, why doesn’t "undefined" == undefined evaluate to true?

Shouldn’t undefined be converted to "undefined" and then return true according to this description?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T05:01:03+00:00Added an answer on June 4, 2026 at 5:01 am

    "undefined" has a value. It is the 9 letters: u-n-d-e-f-i-n-e-d. Therefore, the string “undefined” does not have an undefined value. A String in javascript can have an undefined value, but here the String object has a defined value that just happens to spell “undefined”.

    Using the explanation you’ve provided, the undefined value on the right side would be converted to a String object with no value assigned, and then compared to the String “undefined”, failing the comparison.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is really two questions: Why isn't the membership operator (__contains__) ever being called?
I've been using arrays lately and really missing Python's in operator. e.g.: if (hello
I've seen this pretty funny screencast yesterday about some oddities in languages like Ruby
This is really weird. Its my first time with using the mustache library and
This is really several questions, but anyway... I'm working with a big project in
I found a funny issue with DB2 v9.7 and the SQL LIKE operator. Check
Possible Duplicate: C#: String.Equals vs. == Are string.Equals() and == operator really same? sometimes
I started to really like C#'s ?? operator. And I am quite used to
I'd like to read more about haskell's -> operator. I'm not really clear on
I really can't believe I couldn't find a clear answer to this... How do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.