logical operatorsoperatorfunctionalityexample


Logical Operators

Operator

Functionality

Example/ Explanation

 

 

&&

Looks at 2 expressions & returns a value of "true" if the expressions on the left & right of the operator are both true

If day = 'friday' && date=13 then alert("do You believe in astrology?") Compares the value of the day and the date. If it is true that today is

a Friday and if it is also true that the date is the 13th, then an alert box pops up with the message "Are You believe in astrology?"

 

 

 

 

 

||

Looks at two expressions & returns a value of "true" if either one -- although not both -- of the expressions are true.

if day='friday'&&date=13  then alert("do you believe in astrology?") else if day='friday'||date=13  then alert("Aren't you glad it isn't Friday the 13th?") Compares the value of the day & the value of the date. If it is true that today is a Friday & if it is also true that the date

is the 13th, then an alert box pops up with

the message " do You believe in astrology?" If both are not true, the script moves onto the next line of code...  Which compares the value of the day & the value of the date? If either one -- however not both -- is true, then an alert box pops up with the message "Aren't you glad it isn't Friday the 13th?"

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: logical operatorsoperatorfunctionalityexample
Reference No:- TGS0415970

Expected delivery within 24 Hours