Syntax in JavaScript Assignment Help
Syntax in JavaScript
Javascript program can be written with in HTML starting tag < HTML > and End tag < /HTML >.
Javascript executable statements start with in < script> < /script>. The tag < script> indicates the browser the following statement to be interpreted.
Protocol for Javascript
{` `}
Syntax in JavaScript Assignment Help Through Online Tutoring and Guided Sessions at MyAssignmentHelp
Script tag has two attributes
- Language
- Type
Language –It specifies what scripting language is to be used. Valid values are vbscript and javascript etc., For Javascript the value should be javascript.
Type − This attribute value set to "text/javascript".
2.1 Your First JavaScript Code
The following code is an example for Javascript.
![Javascript Syntax Javascript syntax img1](https://www.assignmenthelp.net/webimg/ahp/javascript-assignment-help/java-script-syntax-img1.jpg)
Scripting language embedded with in < script> < /script> tags. The statement document.write to display the result in output console.
2.2 Whitespace and Line Breaks
JavaScript does not process whitespace and line breaks. The following program illustrate the above.
![Javascript Syntax Javascript syntax img2](https://www.assignmenthelp.net/webimg/ahp/javascript-assignment-help/java-script-syntax-img2.jpg)
2.3 Semicolons are Optional
Each statement in Javascript ends with (;). This is optional. The following example shows how code executes without ending operator(;).
![Javascript Syntax Javascript syntax img3](https://www.assignmenthelp.net/webimg/ahp/javascript-assignment-help/java-script-syntax-img3.jpg)
2.4 Case sensitivity
It is case sensitive language. Upper case letters are different from lower case letters.
Example:
A=10;
a=10;
Here the two variables ‘A’ is not same as ‘a’.
2.5 Comments in JavaScript
Javascript supports the following commenting statements:
{` • // • /*………*/ • < !--.statement //-- > // -It is used to single line as comment line /*….*/-More than one statement as comment line < !-- - It is used to make single line as comment line. The closing tag is //-- > `}
Demo:
![Javascript Syntax Javascript syntax img4](https://www.assignmenthelp.net/webimg/ahp/javascript-assignment-help/java-script-syntax-img4.jpg)
- Namespaces
- Preprocessor Directives
- Regular Expressions
- Exception Handling
- File I/O
- Attributes
- Reflection
- Properties
- Indexers
- Delegates
- Events
- Collections
- Generics
- Anonymous Methods
- Unsafe Code
- Multithreading
- Variables Declarations
- Build In Types
- Operators
- Unary Operators
- Binary Operators
- Array Operations