document.getElementById("demo").innerHTML = "SMGPLAZA."
The semicolon is used to separate statements, a semicolon at the end of the statement or line or syntax, and also use for the multiple statements written in a one-line using a semicolon, and separate this by using semicolons. The syntax of how it’s written in this,
// For a single line statement. var a,b,sum; a=10;b=30; sum=a+b; // For a multiple line statement. var a=10; b=20 ; sum=a+b;
- White Space
You can add white space in your script so sometimes it’s very adorable to understand easily. Js ignores multiple spaces. Syntax is like var name = “Hello”; or var name=”Hello”;
- Line length and breaks.
The programmer has to avoid code lines longer than 80 words/characters. If the statement doesn’t fit in a one-line then it’s better to break the line after the operation.
Js Statement starts with a keyword to identify the action of it. many types of keyword below give this with the description of it,
|break||Terminates a switch or a loop|
|continue||Jumps out of a loop and starts at the top|
|var||Declares a variable|
|do … while||Executes a block of statements, and repeats the block, while a condition is true|
|for||Marks a block of statements to be executed, as long as a condition is true|
|function||Declares a function|
|if … else||Marks a block of statements to be executed, depending on a condition|
|return||Exits a function|
|switch||Marks a block of statements to be executed, depending on different cases|
|try … catch||Implements error handling to a block of statements|
variables are used to store data, var keyword to use declare a variable. In this equal sign is used to assign a value for a variable like var a=20;
A variable must be identified with unique names, and these unique names are called an identifier. for this it’s ruled to define an identifier, 1. names can be in the letter, digit, underscore, and dollar sign. 2.names must start with a letter, and also start with the underscore and $. 3. Names are case sensitive, so reserved words not be used as names.
- Data type
Variable can hold as a number and a text value like “Hello”. Text values are called a string. strings are written inside double and single quotes. Numbers are not written in quotes.
var x=20; var name="hello"; var name='hello'; var _name="hello";
1. Arithmetic operator:- It’s used to perform on a number.
2. Assignment operator:-
|=||x = y||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|
|**=||x **= y||x = x ** y|
3. comparison operator:-
|!==||not equal value|
|>=||greater than or equal to|
|<=||less than or equal to|
4. logical operator:-
5. Type operator:-
|typeof||Returns the type of a variable|
|instanceof||Returns true if an object is an object type|
6. Bitwise Operators:-
|<<||Zero fill left shift|
|>>>||Zero fill right shift|
Also visit this articles :-
- How To Get Started With Python?
- How To Create A Python Snake Game Using Pygame.
- Best Free Games For PC In 2020
- How To Chrome OS Install On PC.
If you have any doubts any suggestions or any query DM us one below Social media handles.
Our Social Media Handles:-
Instagram Handle :- https://www.instagram.com/smgplaza/
Twitter Handle :- https://twitter.com/smgplaza
Thank you so much. You can follow us on social media for more updates.