When I am running the mentioned code. What is the reason behind giving it false and not the second one is it related to ascii value or something else I am Unable to get it. Can anyone explain this?
console.log('2' < '123');
console.log(2 < '123');
When I am running the mentioned code. What is the reason behind giving it false and not the second one is it related to ascii value or something else I am Unable to get it. Can anyone explain this?
console.log('2' < '123');
console.log(2 < '123');
The rules for <
say that:
(Step 3) If you compare a string to a string: Compare them lexically.
(Starting from Step 4c) If you compare a number to a string: Convert the string to a number, then compare them numerically.