Why console.log("2">"12"); is true ??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why console.log("2">"12"); is true ???

11th Jun 2020, 12:13 PM
Dibyajiban Sahoo
Dibyajiban Sahoo - avatar
2 Answers
+ 3
Basically it's a string ,and you know how strings are compared each character is compared with other string character ,and since 2 is greater than 1 so it is true
11th Jun 2020, 12:32 PM
Abhay
Abhay - avatar