#read05 Comparison and logical operators: comparing between values ,the result will be a boolean :T or F
- first s is equal to == ,
it used to comparis between two values to see if they are the same!
example : “welcome”==”hi” its will give us false because its not the same .
- strict equal === ,
it used to comparis two values to see if data type and value are the same !
example: ‘6’===6 it will returns false because they are not the same value or type .
- not equal != ,
it used to comparis between two values to see if they aren’t the same!
example: ‘welcome’!=’hi’ it will give us true.
- **strict not equal ** !== ,
it used to comparis two values to see if data type and value aren’t the same !
example: ‘6’!==6 it will returns true because they arent the same .
logical operators logical opreators allow you to compare the results of more than one Comparison operator. to expression which true or false. the logical operators is:
-
logical and && ,,: these operator test more than one condition . if the two condition is true then it will be true . if any of the condition is false then it will returnsto false.
-
logical or || ,, : this operator test at least one condition. if any of the condition is true it will returns to true . but if the both is false then it will returns to false .
-
logical Not ! ,,: these operator takes single boolean value and inverst it. its make the false true and the true false . !true returns false ! false returns true
for and while loops
Loops : its to check a condition, if it true it will returns until it returns false so it will out of the loop . there are three types of loops :
- for : its used for codes number , if you know how many the code should run use it.so when condition is no longer true , the loops end . the script will move to the next line .
its the most common loop
- while : if you dont know how many the code should run use this while loop , it will continue looping untile it returns false.
so when condition is no longer true , the loops end . the script will move to the next line .