&& evaluation issue
问题 As far as I know, The logical && works like the following var test = false; var foo = test && 42; This code, will assign 42 to foo only if the first condition gets evaluated to true . So in this example, foo will keep its current value. I'm wondering why this snippet doesn't work at all: var test = ""; var foo = test && 42; Now, foo gets the value from test assigned. I'm very confused. The empty string is one of Javascripts falsy values , so why would the && operator fail in this scenario ?