xFactorSchool.com
Python
JavaScript
How to Do Examples
C Examples
Python Examples
HTML Examples
Code Examples
C Code Examples
C++ Code Examples
C# Code Examples
Java Code Examples
Python Code Examples
HTML Code Examples
CSS Code Examples
JavaScript Code Examples
Online Compilers
C Compiler
C++ Compiler
C# Compiler
Java Compiler
Python Compiler
HTML Code Editor
CSS Code Editor
JavaScript Compiler
JavaScript Code Editor
Practice how to use if..else conditional statement in JavaScript
JavaScript Online Editor
Run Code
More JavaScript Sample Codes
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>How to use if..else conditional statement in JavaScript</title> <!--Script is added to write JavaScript code inside it--> <script> var number = 22; function myFunction() { if(number > 25){ //This is false document.getElementById("outPut").innerHTML = "The number is greater than 25."; } else // else will execute { document.getElementById("outPut").innerHTML = "The number is not greater than 25."; } }; </script> </head> <body> <h1>How to use if..else conditional statement in JavaScript?</h1> <button onclick="myFunction()">Click here to see result</button> <p id="outPut"></p> </body> </html>