Question: is undefined true or false javascript?
Answer: The rules for doing that are defined by the specification: Basically, if the value is undefined , null , "" , 0 , or NaN , it coerces to false ; otherwise, it coerces to true . So ! undefined is true because undefined implicitly converts to false , and then ! negates it.