Sunday 23 October 2011

JAVA SCRIPT: Variables, Operators, Statments, Loops

JavaScript is a prototype-based scripting language that is dynamic, weakly typed and has first-class functions. It is a mulch-paradigm language, supporting object-oriented, imperative, and functional programming styles.

JavaScript was formalized in the ECMAScript language standard and is primarily used in the form of client-side JavaScript, implemented as part of a Web browser in order to provide enhanced user interfaces and dynamic websites. This enables programmatic access to computational objects within a host environment.

<html>
<head>
<script type="text/javascript">
function displaydate()
{
document.getElementById ("demo").innerHTML=Date();
}
</script>
</head>
<body>

<h1>My first Javascript</h1>
<p id="demo">this is a paragraph.</p>

<button type="button" onclick="displaydate()">Display Date</button>

</body>
</html>
For short comment : // and comment & for long comment /* and long comment and closed to */

Java Script Variables :
A variables is when java script keep information. the two types of variable ---
  1. Local
  2. Gobble
In Java Script without declaration you can use a variables
Var x;
---------- declare variable
x=27;
-------------
y = 34;  No declaration

JAVA SCRIPT Operators : 
Modulus :
+
-
/
%
++          Inc by,
--            dis by,


 =                               x = y
+=                              x+ =y                    x = x+y
-=                               x-= y                     x = x-y
*=                              x* = y                    x = x*y
/=                              x/ = y                     x = x/y
%=                           x% =y                    x = x%y
Text1           =           " is in";
Text2           =           " Agra";
Text3           =           "Taj Mahal";
Text4           =           Text3+Text1+Text2 


No comments:

Post a Comment