Hi, I provide training in SAP UI5. Also feel free to checkout my new web page https://saptechblog.com

JavaScript: Syntax Overview

In a webpage, JavaScript statements are inserted inside <script> </script> tags.
This script can be included to the webpage by including the script code in :
1. <head>…</head> tags.
2. <body>…</body> tags.
3. Create a separate .js file and link it to the webpage.
The script tags contain two attributes namely:
Language – “javascript”
Text – “text/javascript”
Both the attributes indicate the scripting language used. Usage of type attribute is recommended.
A simple Script program:

Script program:
This is similar to that of ABAP statement displayed below.
Syntax Explanation:
1. Start with a keyword
2. Literals are passed in double quotes in Script and in single quotes in ABAP. We can also pass literals in single quotes in scripts.
3. End of the statement is indicated by ‘.’ in ABAP and ‘;’ in javascript.
4. White spaces and line breaks are ignored. Hence we can give any no of line spaces between two statements as in ABAP.
5. Unlike ABAP, Javascript statements are case sensitive.

About Arun


Powered by Blogger.