<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <!-- If statement -> It is used to execute an instruction or block of instruction only if a condition is fulfilled. syntax: if(condition) { block of statements } --> <script> var a = 18 var b = 30 ; if(a == 18){ document.write("You are eligible to vote"); } else{ document.write("You are not eligible to vote"); } // 2nd example if((a==18) && (b==30)){ document.write("Hello"); } </script> </body> </html>