Here is the function I am working with. I actually found it in React Native documentation :
var testFunction = function(word) {
return word && '';
}
Here is how I am using this function :
var testWord = testFunction("Alex");
The final value of testWord
, returned by testFunction
, is ""
.
I would have expected the returned value to be either true
or false
, as the result of the &&
expression. However the value is a string of value ""
.
Could someone explain the logic behind this ?