Comments in javascript
Any text between a // and the end of a line is treated as a comment and is
Ignored by javascript
Any text between the character /* and */istreated as a comment .this may
Span multiple lines.
Javascript also recognize the HTML comment opening sequence<!—
Javascript treats this as a single-line comment,just as it does the // comment.
The HTML comment closing sequence --> is not recoganized by javascript so it
Should be written as //-->.
EXAMPLE
The following example shows how to use comment in javascript.
<script language=”javascript” type=”text/javascript”>
<!—
// this a comment.it is similar to comment in c++
/*
*this is a multiline comment in javascript
*it is very similar to comment in c programming
*/
//-->
</script>
Javascript variables
like many other programmning languages,javascript has
variables.variables can be thought of as named containers.you can
place data into these containers and then refer to the data simply by
naming the container.
Before you use a variable in javascript program ,you must declare it.
Variables are declared with the var keyword as follows.
, <script type=”text/javascript”>
Var money;
Var name;
</script>
Alert() method
The alert()method displays an alert box with a specified message and
an ok button.an alert box is offen used if you want to make sure
information comes through to the user.
Alert(“hello! I am an alert box!”);
OPERATORS
arithmetic operators
Comparison operators
Logical operators
Assignment operators
Arithmetic operators
Javascript supports the following arithmetic operators-
+(Addition)
-(Substraction)
*(multiplication)
/(division)
%(modulus)
++(increment)
Any text between a // and the end of a line is treated as a comment and is
Ignored by javascript
Any text between the character /* and */istreated as a comment .this may
Span multiple lines.
Javascript also recognize the HTML comment opening sequence<!—
Javascript treats this as a single-line comment,just as it does the // comment.
The HTML comment closing sequence --> is not recoganized by javascript so it
Should be written as //-->.
EXAMPLE
The following example shows how to use comment in javascript.
<script language=”javascript” type=”text/javascript”>
<!—
// this a comment.it is similar to comment in c++
/*
*this is a multiline comment in javascript
*it is very similar to comment in c programming
*/
//-->
</script>
Javascript variables
like many other programmning languages,javascript has
variables.variables can be thought of as named containers.you can
place data into these containers and then refer to the data simply by
naming the container.
Before you use a variable in javascript program ,you must declare it.
Variables are declared with the var keyword as follows.
, <script type=”text/javascript”>
Var money;
Var name;
</script>
Alert() method
The alert()method displays an alert box with a specified message and
an ok button.an alert box is offen used if you want to make sure
information comes through to the user.
Alert(“hello! I am an alert box!”);
OPERATORS
arithmetic operators
Comparison operators
Logical operators
Assignment operators
Arithmetic operators
Javascript supports the following arithmetic operators-
+(Addition)
-(Substraction)
*(multiplication)
/(division)
%(modulus)
++(increment)