Register Login

Login with your site account

Lost your password?

Not a member yet? Register now

WebclassesWebclasses
  • Home
  • Courses
    • Start Learning Here

      • Learn HTML
      • Learn CSS
      • Learn PHP
      • Learn JS
      • Learn SQL
      • Learn C
      • Learn C++
      • Learn 8051

      New Course

      8051 Micro-controller

      8051 Micro-controller

      Free
      Read More
  • Blog
  • Contact Us
    • Home
    • Courses
      • Start Learning Here

        • Learn HTML
        • Learn CSS
        • Learn PHP
        • Learn JS
        • Learn SQL
        • Learn C
        • Learn C++
        • Learn 8051

        New Course

        8051 Micro-controller

        8051 Micro-controller

        Free
        Read More
    • Blog
    • Contact Us
    • Home
    • All courses
    • Javascript Programming

    Javascript Programming

    mahethekiller
    (0 review)
    Free
    Javascript Programming

    JavaScript Comparison

    JavaScript Logical and Comparison Operators

    JavaScript Logical and Comparison Operator are used to test for false or true.

    Comparison Operator
    Operator Description
    > greater than
    < less than
    == equal to
    != not equal to
    >= greater than or equal to
    <= less than or equal to
    === equal value and equal type
    !== not equal value or not equal type
    Logical Operator
    Operator Description
    || or
    && and
    ! not
    Greater than(>) operator

    Example

    var num = 7 ;
     
    (num > 6) ; // This line is used for testing that num is greater than 6

    Code

    <!DOCTYPE html>
    <html>
    	<body>
    		<p>Click on button to testing that num is greater than 6 </p>
    		<button onclick="myFunction()">Click Here</button>
    		<p id="demo"></p>
    		<script> 
    			var num = 7 ;
    			function myFunction(){
    				document.getElementById("demo").innerHTML = (num > 6);
    			}
    		</script>
    	</body>
    </html>

    Output

    Click on button to testing that num is greater than 6

    not equal to(!=) Operator

    Example

    var num = 7 ;
     
    (num != 6); // This line is used for testing that num is not equal to 6

    Code

    <!DOCTYPE html>
    <html>
    	<body>
    		<p>Click on button to testing that num is not equal to 6 </p>
    		<button onclick="myFunction()">Click Here</button>
    		<p id="demo"></p>
    		<script> 
    			var num = 7 ;
    			function myFunction(){
    				document.getElementById("demo").innerHTML = (num != 6);
    			}
    		</script>
    	</body>
    </html>
    

    Output

    Click on button to testing that num is not equal to 6

    less than or equal to(<) Operator

    Example

    var num = 7 ;
     
    (num <= 6) ; // This line is used for testing that num is less than or equal to 6

    Code

    <!DOCTYPE html>
    <html>
    	<body>
    		<p>Click on button to testing that num is less than or equal to 6 </p>
    		<button onclick="myFunction()">Click Here</button>
    		<p id="demo"></p>
    		<script> 
    			var num = 7 ;
    			function myFunction(){
    				document.getElementById("demo").innerHTML = (num <= 6);
    			}
    		</script>
    	</body>
    </html>

    Output

    Click on button to testing that num is less than or equal to 6

    equal to(=) Operator

    Example

    var num = 7 ;
     
    (num <= 7) ; // This line is used for testing that num is equal to 7

    Code

    <!DOCTYPE html>
    <html>
    	<body>
    		<p>Click on button to testing that num is equal to 7 </p>
    		<button onclick="myFunction()">Click Here</button>
    		<p id="demo"></p>
    		<script> 
    			var num = 7 ;
    			function myFunction(){
    				document.getElementById("demo").innerHTML = (num <= 7);
    			}
    		</script>
    	</body>
    </html>

    Output

    Click on button to testing that num is equal to 7

    Prev JavaScript Regular Expression
    Next JavaScript Condition
    • Description
    • Curriculum
    • Instructors
    • Reviews (0)

    JavaScript is the programming language of the Web.All modern HTML pages are using JavaScript.This tutorial will teach you JavaScript from basic to advanced. Webclasses tutorials will help you leaning from beginning.

    Course Features

    • Lectures 28
    • Quizzes 0
    • Skill level Beginner
    • Language English
    • Students 24
    • Certificate No
    • Assessments Self
    • Share:
      • Lecture1.1
        Javascript Introduction
        30m
      • Lecture1.2
        Javascript Code Place
        0m
      • Lecture1.3
        Javascript Syntax
        0m
      • Lecture1.4
        Javascript reserved words
        0m
      • Lecture1.5
        Javascript Statement
        0m
      • Lecture1.6
        Javascript Comment
        0m
      • Lecture1.7
        Javascript Variables
        0m
      • Lecture1.8
        Javascript Data Type
        0m
      • Lecture1.9
        JavaScript Object
        0m
      • Lecture1.10
        JavaScript Function
        0m
      • Lecture1.11
        JavaScript Event
        0m
      • Lecture1.12
        JavaScript String
        0m
      • Lecture1.13
        JavaScript String Method
        0m
      • Lecture1.14
        JavaScript Number
        0m
      • Lecture1.15
        JavaScript Number Method
        0m
      • Lecture1.16
        Javascript Operator
        0m
      • Lecture1.17
        JavaScript Math
        0m
      • Lecture1.18
        JavaScript Dates
        0m
      • Lecture1.19
        JavaScript Array
        0m
      • Lecture1.20
        JavaScript Array Method
        0m
      • Lecture1.21
        JavaScript Booleans
        0m
      • Lecture1.22
        JavaScript Regular Expression
        0m
      • Lecture1.23
        JavaScript Comparison
        0m
      • Lecture1.24
        JavaScript Condition
        0m
      • Lecture1.25
        JavaScript switch statement
        0m
      • Lecture1.26
        JavaScript for Loop
        0m
      • Lecture1.27
        JavaScript while and do-while loop
        0m
      • Lecture1.28
        JavaScript break and continue statement
        0m
    mahethekiller

    Reviews

    Average Rating

    0
    0 rating

    Detailed Rating

    5 stars
    0
    4 stars
    0
    3 stars
    0
    2 stars
    0
    1 star
    0

    You May Like

    8051 Micro-controller Read More
    mahethekiller

    8051 Micro-controller

    50
    0
    Free
    C ++ Programming Read More
    mahethekiller

    C ++ Programming

    20
    0
    Free
    C Programming Read More
    mahethekiller

    C Programming

    0
    0
    Free

    Leave A Reply Cancel reply

    Your email address will not be published. Required fields are marked *

    Latest Courses

    8051 Micro-controller

    8051 Micro-controller

    Free
    Javascript Programming

    Javascript Programming

    Free
    C ++ Programming

    C ++ Programming

    Free

    Recent Posts

    • How to Create a Basic CRUD application Using PHP and MySql
    • Login And Logout Script using PHP Sessions
    • How to Upload an image using Ajax and PHP

    Courses

    • HTML
    • CSS
    • Javascript
    • PHP

    Advanced

    • SQL
    • C Programming
    • C++ Programming
    • 8051 Microcontroller

    Links

    • Home
    • Blog
    • Courses

    Webclasses