Saturday, 7 May 2011

JavaScript Data Types

Unlike in C,C++ and javaa,There are no explicit  data types in javascript.
Numbers,  eg.23,4.3,-230,4.4e,24
Booleans,  eg.true,false
String,       eg,hello,"what is time?"  
Undefined
We will comebackto these data types,but before that we have to haveto define a few new terms

Variables

Variables  give  us  the ability to  manipulate data through reference instead of actual value.Variables are names assigned to values.
Variables  are containers that hold values.

Declearing Variables

Many languages require that a variable be declared before it is first used.Although Javascript allows variable declaration,it does not require it .Except in the case when we want to declare a variable being localmore on local variables later in the course!.

Declearing Variables
var height.var name,address, phone Number

Javascript Variables are Dynamically Typed


Any variable in javascript can hold any type of value,and that type can changemidway throgh the progam.
This is unlike the case for C,C++ and java,where a variable's type is defiend before usage.
The untyped feature makes Javascript simpler to program in when developing short programs.However,this feature brings in a few problems as well.

JavaScripts Operators.

Operators operates on oprands to achieve the desired results
JavaScript has numerous operators, classified in many categories.We willlook at only a few of thembelonging to the fellowing categories.

Assignment operators
Arithmetic operators
Comparison operators
String operators
Logical operators

No comments:

Post a Comment