<!DOCTYPE html> <html> <head> <meta charset="ISO-8859-1"> <title>Javascript IF ... ELSE</title> <script type="text/javascript"> /* == is equal to === equal value and equal type != is not equal to !== not equal value or not equal type > is greater than < is less than >= is greater than or equal to <= is less than or equal to */ var age = 20; if (age == 18) { document.write("the age is == 18"); } else if (age > 18) { document.write("the age is > 18"); } else { document.write("the age is <= to 18"); } </script> </head> <body> </body> </html>
OUTPUT