Matias Cicero
Matias Cicero

Reputation: 26331

Why does ";" == ";" evaluates to "false"?

Why does this (Firebug Console):

> ";" == ";"
> false

But this:

> ';' == ';'
> true

Anyone knows why this is happening?

Upvotes: 0

Views: 470

Answers (3)

Anubiska
Anubiska

Reputation: 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

Upvotes: -1

jPO
jPO

Reputation: 2552

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

Upvotes: 0

Quentin
Quentin

Reputation: 944442

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.

Upvotes: 6

Related Questions