Tuesday, January 3, 2017

Booleans

JavaScript booleans represent either true or false values. We use Boolean() function to determine whether an expression is true or not. To compare conditions you can use equal to (==), greater than (>) and less than (<) symbols. This operators can be used to determine equality or difference between variables and values. You may also use (!=) to determine that the two expressions are not equal to each other. You could also use operators to assign a value to a variable based on some condition. So for example you want to come back with a certain statement based on the users condition, you can use the following line

     variablename = (condition) ? value1:value2
 in which case value one would return "You are old enough" and value two would return "You are old enough". 


No comments:

Post a Comment