Collection[0][pre]==true => false no type conversion

Collection[0][pre]==true => false no type conversion
0

#1

Why collection=[{“user”: “Tinky-Winky”, “sex”: “male”}, {“user”: “Dipsy”, “sex”: “male”}, {“user”: “Laa-Laa”, “sex”: “female”}, {“user”: “Po”, “sex”: “female”}]
pre=“sex”

collection[0][pre]==true

returns false
Boolean(collection[0][pre])==true

returns true


#2

"male" does not equal true, it equals "male"

The Boolean function converts anything you give it to true or false, and "male" is a truthy value, so it evaluates to true, and true is equal to true