If I pass the text “Ninja” as
strWarriorType to a method, the following evaluate as true:
But this evaluates as false:
strWarriorType.toUpperCase() == "NINJA"
Update: Illumination from a Friend
@mrcoulson == compares objects, not values. strWarriorType and the string literal are two DIFFERENT objects. Use methods to compare values
— Jeremy Carbaugh (@jcarbaugh) June 15, 2014
I did similar tests in PHP, C#, and Python and discovered that they all handled my
== operator exactly as I expected. New stuff has been learned!