Saturday, February 26, 2011

JAVA SCRIPT- LEARN TO BUILD WEBSITES


  Here we are learning about
• Values, Variables, and Literals
• Expressions and Operators
• Regular Expressions
• Statements
• Functions
• Working with Objects
• Details of the Object Model


first let us describe wat is Values, Variables, and Literals:


VALUES:

JavaScript recognizes the following types of values:
• Numbers, such as 42 or 3.14159.
• Logical (Boolean) values, either true or false.
• Strings, such as “Howdy!”.
• null, a special keyword denoting a null value; null is also a primitive
value. Because JavaScript is case sensitive, null is not the same as Null,
NULL, or any other variant.

• undefined, a top-level property whose value is undefined; undefined is
also a primitive value.
This relatively small set of types of values, or data types, enables you to
perform useful functions with your applications. There is no explicit distinction
between integer and real-valued numbers. Nor is there an explicit date data
type in JavaScript. However, you can use the Date object and its methods to
handle dates.
Objects and functions are the other fundamental elements in the language. You
can think of objects as named containers for values, and functions as
procedures that your application can perform.

Data Type Conversion:

JavaScript is a dynamically typed language. That means you do not have to
specify the data type of a variable when you declare it, and data types are
converted automatically as needed during script execution. So, for example,
you could define a variable as follows:
var answer = 42
And later, you could assign the same variable a string value, for example,
answer = "Thanks for all the fish..."
Because JavaScript is dynamically typed, this assignment does not cause an
error message.
In expressions involving numeric and string values with the + operator,
JavaScript converts numeric values to strings. For example, consider the
following statements:
x = "The answer is " + 42 // returns "The answer is 42"
y = 42 + " is the answer" // returns "42 is the answer"
In statements involving other operators, JavaScript does not convert numeric
values to strings. For example:
"37" - 7 // returns 30
"37" + 7 // returns 377



No comments:

Post a Comment

Tweet