JavaScript DataTypes:-
There is the most fundamental characteristics of a programming language is the collection ofdata types it supports. These are the type of values that can be represented and manipulated in a programming language.
JavaScript always allows you to work with 3 primitive data types:
1)Numbers eg. 123456, 123.50 etc.
2)Strings of text e.g. "This text is string" etc.
3)Boolean e.g. true or false.
JavaScript also defines two trivial data types:
1)Null
2)Undefined,
Each of which defines only a single value.
In addition to these primitive data types, JavaScript supports a composite data type known as object.
Note: Java does not make a distinction between integer values and floating-point values. All numbers in JavaScript are represented as floating-point values. JavaScript represents numbers using the 64-bit floating-point format defined by the IEEE 754 standard.
JavaScript Variables:
-Variable names must begin with a letter.
-Variable names can also begin with $ and _ (but we will not use it)
-Variable names are case sensitive (y and Y are different variables)
The Scope Of JavaScript Variable.
The scope of a variable is the region of your program in which it is defined. JavaScript variable will have only two scopes.
Global Variables: A global variable has global scope which means it is defined everywhere in your JavaScript code.
Local Variables: A local variable will be visible only within a function where it is defined. Function parameters are always local to that function.
Within the body of a function, a local variable takes precedence over a global variable with the same name. If you declare a local variable or function parameter with the same name as a global variable, you effectively hide the global variable. Following example explains it:
<script type="text/javascript">
<!--
var myVar = "global"; // Declare a global variable
function checkscope( ) {
var myVar = "local"; // Declare a local variable
document.write(myVar);
}
//-->
</script>
Output Is,
Posted by Amit Tiwari
WOW AMAZING this article is very usefull for me thanks..
ReplyDeleteVisits back http://malikmal98.blogspot.com
Thankyou IKMALIL....If you want to know any doubt ..just mail me on amittiwari92.ies@gmail.com or just comment here..i ll reply you .....take care
ReplyDelete