Search PPTs

Thursday, July 25, 2013

PPT On JavaScript Syntax

Presentation On JavaScript Syntax
Download

JavaScript Syntax Presentation Transcript:
1.JavaScript Syntax

2.A JavaScript consists of JavaScript statements that are placed within the HTML tags in a web page.
You can place the
The script tag takes two important attributes:
language: This attribute specifies what scripting language you are using. Typically, its value will be javascript. Although recent versions of HTML (and XHTML, its successor) have phased out the use of this attribute.
type: This attribute is what is now recommended to indicate the scripting language in use and its value should be set to "text/javascript".

4.So your JavaScript segment will look like:


5.Your First JavaScript Script:
Let us write our class example to print out "Hello World".


6.We added an optional HTML comment that surrounds our Javascript code. This is to save our code from a browser that does not support Javascript. The comment ends with a "//-->". Here "//" signifies a comment in Javascript, so we add that to prevent a browser from reading the end of the HTML comment in as a piece of JavaScript code.
Next, we call a function document.write which writes a string into our HTML document. This function can be used to write text, HTML, or both. So above code will display following result:
Hello World!

7.Whitespace and Line Breaks:
JavaScript ignores spaces, tabs, and newlines that appear in JavaScript programs.
Because you can use spaces, tabs, and newlines freely in your program so you are free to format and indent your programs in a neat and consistent way that makes the code easy to read and understand.

8.Semicolons are Optional:
Simple statements in JavaScript are generally followed by a semicolon character, just as they are in C, C++, and Java. JavaScript, however, allows you to omit this semicolon if your statements are each placed on a separate line. For example, the following code could be written without semicolons

9.
But when formatted in a single line as follows, the semicolons are required:


10.Case Sensitivity:
JavaScript is a case-sensitive language. This means that language keywords, variables, function names, and any other identifiers must always be typed with a consistent capitalization of letters.
So identifiers Time, TIme and TIME will have different meanings in JavaScript.
NOTE: Care should be taken while writing your variable and function names in JavaScript.

No comments:

Related Posts Plugin for WordPress, Blogger...

Blog Archive