Coersion (CR20)
1: console.log("10" > 5); // Output: true ("10" coerced to 10)
2: console.log("5" < 10); // Output: true ("5" coerced to 5)
3: console.log(5 > "apple"); // Output: false ("apple" coerced to NaN, NaN comparisons always false)
Mixed Type Comparisons (String and Number): If one operand is a string and the other a number, the string is converted to a number. Then, numerical comparison is performed. true true false
Coersion context:
ES6 context:
- (2024) Notes about JS Closures. #ES6
- (2024) Notes about Javascript asynchronous programming. #ES6
- (2022) Modern Javascript books #ES6 #Doc
- (2021) JS learning start point #ES6
- (2021) Maximilian Schwarzmüller Javascript lecture #ES6
- (2021) Javascript interview question from Happy Rawat #ES6
- (2021) Javascript tests #ES6
- (2016) New unique features of Javascript (updated). #ES6
Comments (
)

Link to this page:
http://www.vb-net.com/JavascriptES6/CR20.htm
|