0

Why I am getting the output false ?

console.log("2" < "12")

8/17/2019 11:46:09 AM

Umesh Kushwaha

5 Answers

New Answer

+5

JavaScript compares the strings according to their lexicographical (dictionary) order based on Unicode. The first character '2' is 'larger' than '1'. https://javascript.info/comparison

+1

Thanks Hatsy.

0

I think you are comparing strings (“”) and not integers

0

Yes, but output should be true.

0

I don’t really know that much about JS so why would that be true?