![]() ![]() The following web document demonstrates the use of OR operator (||). So we can conclude that in LOGICAL OR operation if any of the conditions are true, the output is TRUE or 1. Which explains that if any of conditions are TRUE or 1, the return is TRUE or 1. In fig.-2 of the picture, one of the taps are closed, and we can see that the water is flowing down. The above pictorial helps you to understand the concept of LOGICAL OR operation with an analogy of taps and water. NewParagraph1.appendChild(newText1) //created text is appended to the paragraph element createdÄ(newParagraph1) // created paragraph and text along with output is appended to the document body Var newText1 = document.createTextNode('Wrong input') //creates text along with ouput to be displayed Var newParagraph1 = document.createElement("p") //creates a new paragraph element NewParagraph.appendChild(newText) //created text is appended to the paragraph element createdÄ(newParagraph) // created paragraph and text along with output is appended to the document body ![]() Var newText = document.createTextNode('The number is between 5 and 10') //creates text along with ouput to be displayed Var newParagraph = document.createElement("p") //creates a new paragraph element Var no = document.getElementById('no').value The following web document demonstrates the use of AND operator (&). So we can conclude that if and only if, both of the conditions are TRUE or 1, LOGICAL AND operations returns TRUE or 1. Which explains that if both of conditions are TRUE or 1, the return is TRUE or 1. In fig.-4 of the picture, both of the taps are open, so the water is flowing down. Which explains that even if any of conditions are FALSE or 0, the return is FALSE or 0. ![]() ![]() In fig.-2 of the picture, one of the taps are closed, even then, the water is not flowing down. Which explains that if both of conditions are FALSE or 0, the return is FALSE or 0. In fig.-1 of the picture, both of the taps are closed, so the water is not flowing down. This above pictorial helps you to understand the concept of LOGICAL AND operation with an analogy of taps and water. ![]()
0 Comments
Leave a Reply. |