0

Why does this (Firebug Console):

> ";" == ";"
> false

But this:

> ';' == ';'
> true

Anyone knows why this is happening?

3
  • 2
    compare both ";".charCodeAt(0)
    – Alex K.
    Apr 16, 2015 at 12:07
  • jsfiddle.net/fNPvf/14147
    – P.JAYASRI
    Apr 16, 2015 at 12:10
  • 1
    @P.JAYASRI — What's the point of that link? It doesn't have the same code as the question.
    – Quentin
    Apr 16, 2015 at 12:10

3 Answers 3

6

Because, despite looking similar, U+037E : GREEK QUESTION MARK is not the same as U+003B : SEMICOLON

What Unicode character is this? to the rescue for this kind of trick question.

0

As @Quentin said. Those characters aren't the same. The semicolons in the first example aren't both semicolons. Don't copy and paste, try to write it yourself and you'll see, there is no difference and they'll both return true. HOWGH

-1

Because

; is an English keyboard language set

And ; is a Greek keyboard language imput.

So the program is identifying two different languages, and seeing them a false , because they aren't the same keyboard format.

So please make sure to use the same keyboard for all your programming efforts

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.