JavaScript
  Home arrow JavaScript arrow The Power of Javascript: Basic Types of Da...
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 
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

The Power of Javascript: Basic Types of Data
By: Michael Youssef
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 21
    2005-07-12

    Table of Contents:
  • The Power of Javascript: Basic Types of Data
  • Data as Numbers
  • Boolean Data, Yes or No
  • One Small Change

  • 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


    The Power of Javascript: Basic Types of Data


    (Page 1 of 4 )

    Javascript interpreters understand two different, basic types of data: numbers and character strings. But interpreters only understand these data types when they are presented in certain ways. This article, the third in a series, will explain what these types of data are, and how to handle them.

    We are still at the stage of examining basic concepts in Javascript. In this article we are going to learn about the basic types of data that Javascript interpreters understand and manipulate. Programming languages differentiate between the various data we store and manipulate. To help you understand what I mean, suppose that we need to add two values and store the result in a variable. These values may be one of the following pairs:

    45, 87
    or
    "Hello", 23
    or
    "Hi", "Name"

    So when we use the plus symbol (which is called an operator in Javascript, and will be discussed with the other available operators in the following articles) with the first pair ( 45 + 87 ), Javascript understands that we are performing an addition operation on numbers. When we use the plus symbol with the third pair (the characters text), it understands that we need to perform an operation called concatenation, which produces a text of the first value and the second value together. If we concatenate "Hi" + "Name" it produces one text, "HiName."

    We will talk more about the double quotes and why we put them in, but for now we need to understand that programming languages must differentiate between numbers and text because, as you will see in this article, the operations (like the addition operation) produce different values depending on the type of data we are dealing with (numbers or text), which are called basic data types because they are the simplest form of data that we can manipulate. The second pair is discussed with an example in this article because it's an interesting example for a Javascript beginner.

    More JavaScript Articles
    More By Michael Youssef


     

    JAVASCRIPT ARTICLES

    - Building Dynamic Shadows with JavaScript and...
    - Active Client Pages: Chrys`s Approach
    - The Script Approach to Active Client Pages: ...
    - Principles of Active Client Pages: the Scrip...
    - Active Client Pages: the Script Approach
    - Building an RTF-capable Form with the Ext JS...
    - Creating a Multi-Tabbed Online Form with the...
    - jQuery Overview
    - Constructing a Multi-Column Online Form with...
    - Grouping Field Sets on Dynamic Web Forms wit...
    - Building Dynamic Web Forms with the Ext JS F...
    - More on JavaScript Array Objects
    - Methods of the DOM Location Object
    - The DOM Location Object Properties
    - Handling Remote Files with JavaScript Click ...







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