JavaScript
  Home arrow JavaScript arrow Page 5 - JavaScript Operators
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVASCRIPT

JavaScript Operators
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 3
    2007-11-05

    Table of Contents:
  • JavaScript Operators
  • Arithmetic Operators
  • Assignment Operators
  • Add and Assign
  • Comparison Operators
  • Logical Captain?

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    JavaScript Operators - Comparison Operators


    (Page 5 of 6 )

    In the hopes of not getting sued, I am going to create a fictional fast food restaurant. Let's say this fast food "restaurant" serves Mexican food (though in truth you would never find these things on the menu in Mexico). We'll give it a neat little name: Burrito Bell. So now let's say you went to this Burrito Bell and bought a taco for about 20 cents. Then you go to grocery store and buy a taco kit and ground beef and make your own taco and stand them side by side.

    The 20 cent taco looks nothing like your $3.00 homemade taco. Even the shells look different. The disturbing thing though is that when you look, smell, and taste the meat in the 20 cent taco you realize the creepy thing: that ain't hamburger beef. Hell, maybe it isn't beef period. I mean, what is that? Granted, you can't expect filet mignon in a 20 cent taco. But this stuff isn't even horse.

    Now mind you, I still eat at this theoretical Burrito Bell. I'm just saying when you compare real meat to the Burrito Bell meat, something isn't matching up.

    In JavaScript you can use Comparison Operators to compare values to one another. These are exceptionally handy when used in statements and loops (we will cover loops soon). But for now, let's work with a Boolean variable (boolean is a true/false, on/off, yes/no type of data).


    <HTML>

    <HEAD>

    <script type="text/Javascript">


    document.write(2 > 1)

    </SCRIPT>

    </HEAD>

    </HTML>

    The above would result in the following printing to your screen:

      True.

    What we have done is asked the computer to compare the values of 2 and 1. We stated that 2 was greater than 1 and asked the computer if this was true or false. The computer, being slightly smarter than you, told us it was True. Had we evaluated the statement 2 < 1, it would have returned a False response.

    More JavaScript Articles
    More By James Payne


       · In this article we discuss Javascript Operators and how to use them to manipulate...
     

    JAVASCRIPT ARTICLES

    - More on JavaScript Array Objects
    - Methods of the DOM Location Object
    - The DOM Location Object Properties
    - Handling Remote Files with JavaScript Click ...
    - Using Click Interceptions with a Database-Dr...
    - Using JavaScript Click Interceptions in an I...
    - Using Click Interceptions with JavaScript
    - QuickSort in Action
    - Quicksort
    - Using Mod_Security to Protect Your Server
    - Detecting and Countering Server Intrusions
    - Securing Your Web Server
    - Building a Secure Web Server
    - Protecting the Server
    - Book Review: Learning the Yahoo! User Interf...


     
    Best Practices for Windows Vista Migration Presentation
    Dell and Microsoft recently held a series of face-to-face seminars entitled, &qu....

     
    Creating a Culture for Code Reuse
    If you oversee development teams you know that like it or not proprietary and ex....

     
    Keys to Web Application Acceleration: Advances in Delivery Systems
    Accelerate Web apps by up to 5x. Ensure significantly faster access to the Web a....

     
    Optimizing Application Monitoring
    Tired of finding out from your customers that you're offline? This white paper e....

     
    Solaris to Solaris Migration -- Migrating applications from Sun SPARC to Dell PowerEdge R900
    This comprehensive Migration Guide reviews the approach that Principled Technolo....

     





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
    Stay green...Green IT