Untitled Document



 Introduction to HTML
 Structure of HTML
 Creating First HTML  Document
 Building Your HTML  Document
 Tables
 Frames
 Including Images into  Document
 Including Multimedia
 Developing HTML  FORMS
 Using Style Sheet
 Understanding URLs
 Using JavaScript
 Introducing JavaScript
   Using JavaScript
 Introducing to  JavaScript
   What is JavaScript?
 Why should you use  Java Script?
 Structure of a  JavaScript
   Syntax of JavaScript
 JavaScript
 Statements
 
 Statements
 Blocks
 
 Blocks
 Comments
 
   Comments
 Single-Line  Comments
 Multiline Comments
 Data
 
   Data
   Strings
   Numbers
   Boolean
 Null
 Expressions
 
   Expressions
   Numeric Expressions
 Logical Expressions
 Variables
 
   Variables
 Defining and Naming  Variables
 Changing the Value  of a Variable
 Functions
 
   Functions
   Built-in Functions
 User-Defined  Functions
 Returning Values  from Function
 Flow Control
 
   Flow Control
   If and if ....else
   If Statement
   If...else Statement
   IF Statement
   Looping Statements
   For Loops
   While Loops
   WHILE Statement
   Switch Statement
   Break Statement
 Continue Statement
 Objects
 
   Objects
   Methods
   Properties
   Built-in Objects
 User-defined Objects
 Arrays
 
 Arrays
 Event Handlers
 
   Event Handlers
 onMouseOver,  onMouseOut Events
 onClick, onChange  Events Handlers
 Using the onSubmit  Event Handler
 Introduction to Cookies
 
 Introduction to  Cookies
   Sessions Cookies
 Persistent Cookies
 Using Java

Copyrights : Layout Galaxy All Rights Reserved
No part of this tutorial may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, electrostatic, magnetic tape, mechanical or otherwise, without prior permission in writing from Layout Galaxy.




  Using JavaScript > Data

  Data

One of the basic tenets of programs is that they have to work on data. Data is any type of information with which you are working. Data can be words, such as "Hello There", or numbers, such as 42 or 381.33. In any case, different programming languages enable you to work on different kinds of data. JavaScript has five fundamental data types: String, Number, Boolean, Object and Null.

Strings
Numbers
Boolean
Null

  Strings

A string is any grouping of characters that is surrounded by either double quotation marks (") or single quotation marks ('). Strings are used anytime you want to use text in a program. Single quotes are used when you want to use double quotes in the string.

Example :

"Welcome"
'Good Morning'

'A string that contains "double quotes"'

  Numbers

JavaScript is quite flexible in the ways it enables you to represent numbers. Many programming languages make you divide ahead of time what type of number you will be using.

Example :

18          // The decimal integer 18
104.2     // The floating point number 104.2
0.058     // The floating point number 0.058

  Boolean

A Boolean is the simplest data type available. A Boolean value has only two possible values-true and false. They are often used to represent whether something has been done or not.

Example :

static boolean ans; // ans is a boolean variable
static String first="were";
static String second="where";
if (first= =second) // Checks if string "first" is equal to string "second"
{
            ans=true;
}
else
{
            ans=false;
}

  Null

class first
{
String s;// s is a string
public static void main(String args[ ])
   {
               first my = new first(); // Creates an instance of class first
               System.out.println(my.s); //Prints null since String is initialized to null by default
   }
}

Back Next


Copyrights : Layout Galaxy All Rights Reserved
No part of this tutorial may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, electrostatic, magnetic tape, mechanical or otherwise, without prior permission in writing from Layout Galaxy.




17, Vadsarvala Nivas, 65-A, J. Nehru Road, Mulund (W), Mumbai - 400 080 INDIA
Tel : 91-22-25795588, 91-22-25780444 Fax : 91-22-25793397
Email : ionline@vsnl.com
© Image Online 2001-2003