Javascript Statement:-
JS programming instructions are called statements. JavaScript program is a list of programming statements. statements are composed of Values, Operators, Expressions, Keywords, and Comments. These statements are executed one by one and in the same order as are written. The syntax is like,
for all javascript, tutorial follow this link: https://smgplaza.com/category/javascript/
document.getElementById("demo").innerHTML = "SMGPLAZA."
JavaScript Semicolons, white space, line breaks and keywords.
- Semicolon
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.
- Keywords.
Js Statement starts with a keyword to identify the action of it. many types of keyword below give this with the description of it,Keyword Description 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
JavaScript Syntax.
- Variable
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;
- Comment
A single-line comment starts with the // symbol, And in JavaScript, you can ignore to end this comment. For multiple line comment starts with /* and end with */ so basically it’s like /* …………………. */, usually when to write a basic brief of one or multiple lines or paragraph you can use it.
- Identifier
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";
. Operator:-
1. Arithmetic operator:- It’s used to perform on a number.Operator Description + Addition – Subtraction * Multiplication ** Exponentiation / Division % Modulus ++ Increment — Decrement
2. Assignment operator:-Operator Example Same As = 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:-Operator Description == equal to === equal value != not equal !== not equal value > greater than < less than >= greater than or equal to <= less than or equal to ? ternary operator
4. logical operator:-Operator Description && logical and || logical or ! logical not
5. Type operator:-Operator Description typeof Returns the type of a variable instanceof Returns true if an object is an object type
6. Bitwise Operators:-Operator Description & AND | OR ~ NOT ^ XOR << Zero fill left shift >> right 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.