What is the difference between the two lines in the following JavaScript code?
!!(obj1 && obj2);
(obj1 && obj2);
a) Both the lines result in a boolean value “True”
b) Both the lines result in a boolean value “False”
c) Both the lines check just for the existence of the object alone
d) The first line results in a real boolean value whereas the second line merely checks for the existence of the objects
Answer: d
Explanation: The first returns a “real” boolean value, because you first negate what is inside the parenthesis, but then immediately negate it again. So, it’s like saying something is “not not” truth-y, making it true. The second example simply checks for the existence of the obj1 and obj2, but might not necessarily return a “real” boolean value, instead returning something that is either truth-y or false-y. This can be problematic, because false-y can be the number 0, or an empty string, etc. Simple existence can be truth-y. A “real” boolean will only be true or false.
Related Posts
Empdt1(empcode, name, street, city, state, pincode).
For any pincode, there is only one city and state. Also, for given street, city and state, there is just one pincode. In normalization terms, empdt1 is a relation inWhich forms are based on the concept of functional dependency:
Which forms has a relation that possesses data about an individual entity:
Which forms simplifies and ensures that there are minimal data aggregates and repetitive groups:
Which is a bottom-up approach to database design that design by examining the relationship between attributes:
Functional Dependencies are the types of constraints that are based on______
Which-one ofthe following statements about normal forms is FALSE?
Join The Discussion