Hello
Try a algorithm
try a algorithm
za=xa+xb;Custom Popup Example
Popup Message
This is a custom popup!
The JavaScript Syntax define two types of values
● Fixed Values .
● Variable Values .
fix values are called literals.
variable values are called variables.
java script Part 1
ex1
JavaScript numbers
In this example We are going to learn About Numbers Can be written
Wait or without Decimals in JavaScript
ex2
JavaScript strings
in JavaScript strings can be written with double or single quotes
Java Script Variables
in a programming language Variables are used to store data valuesJavaScript uses the keywords like ●var ●let and ●const to declare variables
an equal sign is used to Ascend values to variables
in this example X is defined as a variable then X is assign [given] the value 6
ex3
JavaScript uses the keyword [ver], [let] and [cont] to declare variablesan equal sign is used to assign values to variables.
in this example X is defined as a variable then x is assign (given) the value 6:
ex4
JavaScript uses arithmetic operators[+,-,*,/] to compute values.JavaScript operators
JavaScript uses arithmetic operators to conflued values just like algebra
in this example we are going to demonstrate a simple arithmetic operation 10*(5+5)/5
ex5
Java Script Expressions
an expression is a combination of values, variables, operators, which
computes to a value.
Tha computation is called an evaluate.
For example, 5*10 evaluates to 50:
ex6
fine JavaScript values
in JavaScript the = operator is used to assign values to variables
JavaScript uses the = operator as a assignment operator
ex7
java script Expressions
Expressions compute to value
ex8
Use Of ["text 1"+" "+"text 2"]
the values can be verious type such as number, text or data , strings
For an example jhon and doe are two different words now we going to attack
both words using the ["text 1"+" "+"text2"] operator so let's begin our
text1 is Jhon , and text2 is Doe , now we are attaching theme both =
PART 2
Java Script Variables
Variables are likely containers for storing Data
In Java Script Variablescan be declared in 4 ways ->
- Automatic
- Using Var (if someone is want to work his codes in old computers )
- Using Let
- Using Const(if the value is constant and unchangeable )
Ex 1
JavaScript Variables
Automatic Variables
Use of automatic variables, -> They are automatically declared if
we didn't declare them
ex2
Use of Var
In this example x,y,z are variables ,where x = 5,y = 15 and z = x+y
ex3
Use of const
In this example x ,y,z are variables , x =5, y =15, z =x+y
ex4
another use of const
In this example
Pice1 =9
pice2 =11
the the
Additional Info
- Always declare variables
- Always use const if the value should not be changed
- Always use const if the type should not be changed (Arrays and Objects)
- Only use let if you can't use const
- Only use var if you MUST support old browsers.
PART 3
Sl.No | oprator | Description |
---|---|---|
1. | (+) | addition যোগ |
2. | (-) | subtraction বিয়োগ |
3. | (*) | multiplication গুন |
4. | (/) | division ভাগ |
5. | (**) | exponentiation বর্গ বা power |
6. | (++) | increment বৃদ্ধি |
7. | (%) | modulus ভাগশেষ |
8. | (--) | decrement হ্রাস |
Ex1
addition (+)
In this example We are going to learn about the addition ➕ oprator . in java script we can do arithmetic calculations like let x=7 y=3 , and z= x+y then,
Ex2
subtraction (-)
in this example we are going to learn about the subtraction (-) oprator assume x=17,y=7,and z=x-y then
Ex 3
multiplication (*)
in this example we are going to learn about the operator (*) which is known multiplication, x=7 y=100, and z=x*y then,
Ex 4
devider (/)
in this example we are going to learn about the devider (/) operator, assume x=70 ,y=7 and z=x/y
Ex 5
modulus (%)
in this example we are going to learn about the modulus Operator(%), Assume x=237 y=14; now if we devide x and y then we will get a deviation number lets address it as A and we will also get a left over number in Bengaliwhich is called ভাগশেষ lets lets address it z .then
Ex 6
increment (++)
In this example We are going to learn about the increment Oprator (++), Assume x=99 if we use increase Oprator (x++) one time it will become
Ex 7
decrement (--)
in this example we are going to learn about the decrement operato(--), Assume x=101 if we use the decrement oprator for one time then the result will be
Ex 8
exponentiation (**)
in this example we are going to learn about the Exponentiation (**) operator it is also known as power in maths. assume x=5 and i use 7 as exponentiation or power (x**7) then the result will be
Ex 9
another use of exponentiation (**)
in some cases we can use the exponentiation oprator (**) operator with others mathematical equation like suppose i have a number 175 and along with that i am using the exponentiation oprator with 5 and the power is 5 then the equation will be [175+5**2]=
Part 4
let's talk about the assignment operators that are commonly used in JavaScript variables
Sl. No | Oprator | Operator Name | Operator Usage |
---|---|---|---|
1. | (=) | assingment Oprator | To assing a value of a veriable |
2. | (+=) | Addition Assignment | To add a value to the variable and store it back into the veriable |
3. | (-=) | Subtraction Assignment | To subtract a value from the variable and store it back into the veriable |
4. | (*=) | multiplication Assignment | To multiply a value to the variable and store it back into the veriable |
5. | (/=) | division Assignment | To devide a value by the variable and store it back into the veriable |
6. | (%=) | remainder Assignment | To devide a value by the variable and store the remainder value back into the veriable |
7. | (**=) | exponentiation Assignment | This veriable is used to rise a veriable's value exponentially and then store the exponential value in to the veriable |
Part 4
EX 1
Use Of (=)oprator
in this example we are going tolearn about the use of (=) oprator . this oprator is used to assing the value of variables . assume that "x " is an oprator and we are going to assing value 10 for the oprator .so the code will be "let x=10;" then the result will be
EX 2
the (=+) oprator
in this example we are going to learn about the use of the (=+) oprator. assume that x and y are are two oprator x=7 y=3 now we are going to use (=+) oprator which used to adition values in the veriable and then store it back into the veriable in this example x's value is 7 and we are going tho add y's value is 3 now we are going to add y's value into xand then store it back into the veriable the code will be(let y=3; let x=7+y;) then the result will be
EX 3
How to use (=+) oprator in a same veriable
in this example we are going to learn how to use (=+) in a same variable. assume that x=8 and we are going to adition 2 in that example then store it back in the veriable x . the code will be(let x=8; x+=2;) then the result will be
Ex 4
A different use of(+=) in text
In this example we are going to learn about the use of (+=) oprator in text. assume that "Hello" is a word and "World" is another word we can join them using (+=) the code will be (let text=" Hello"; text+=" World";)=
Ex 5
The use of (-=) Oprator
in this example we are going to learn about the subtraction assingment.it is used to subtract a value or veriable or text from the veriable. now assume that x is a veriable abd x=12 and we are going to subtract the value 2 from the veriable and then store it back into the veriable the code will be (let x=12; x-=2;) and the result will be=
Ex 6
the use of multiplication assingment(*=)
in this examole we are going to learn about the use of (*=) oprator which is called multiplocation assingment. it is used to multipli the veriabl's value by aother veriable or number or text. assume that x is a veriable and the value of x is 10 and we are going to multipli the veriable's value by 5 thenb the code will be ( let x=10; x*=5;) the the result will be
Ex 7
use of (**=) exponentiation oprator
in this example we are going to learn about the exponentiation oprator (**=). this oprator is used to elaaute the power of the veriable's value by another veriable or text , then store it back in the veriable .Assume that x is a veriable and its value is 10 and we ase using 5 as the value of the exponentiation it will multiply 10 with the power like (10x10x10x10x10). the code will be (let x=10; x**=5;) and the result will be x=
EX 8
The oprator (/=) division assingment
in this example we are going to learn about the division assingment oprator (/=). this oprator is used to devide a veriable's value by an another veriable or number or text then it store back the devided value into the veriable. assume that x is a veriable its value is 10 then we are using the (/=) oprator and deviding the veriable's value by 5 then the result will be automatically store into the veriable . the code will be (let x=10; x/=5) and the result will be
EX 9
The remainder assingment (%=) oprator
the remainder assingment opratior is also known as the mosulus assingment oprator . it is used to devide the variable's value by an another veriable or text or number then store the remaining or modulus into the veriable . assume that x is a veriable and its value is 10 and we are deviding x's value by 3 using (%=) oprator then it automatically store it back into the veriable . the code will be (let x=10; x%=3;) and the result will be
EX 10
The use of left shift oprator (<<=)
this veriable is used to shift the binary positon of a number in this case we are taking x as a veriable x=-100 and we are using left shift (<<=) oprator as x <<=5 . it means the binary number will shift to left by 5 positions . each left shift by one position multiplies the value by 2 it means in this case the multiplication is 25 because we used x<<=5 if we had used any another number the like x<<=7 then the value would have shifted 7 position from its original position and the number 5 would have replaced by 7 and it would had become 27 . it automatically store the shifted value into the veriable .
Sl.no | Oprator | Name | Use |
---|---|---|---|
1. | (<<=) | Left Shift Oprator | to shift the variable's value left by its original position or give it a squere value |
2. | (>>=) | Right Shift Oprator | to shift the variable's value by its original position or make a squere root of a veriable's valur |
3. | (>>>=) | Bitwise zero-fill right shift Shift Oprator | it filles zeros as many as you entered in the code before the numbers;s binary form and change the number exponentiatonally |
Ex 11
The left shift oprator("<<=")
in this example we are going to learn about the left shift oprator(<<=) it is used to shift the veriables value in binar how long you want in this case we are we are taking x as a veriable and its valye is 10 so if we shift its value by 4 position the code will be (let x=10; x<<=4) and the result will be
Ex 12
The Use of (>>=) oprator
in this example we are going to learn about the (>>=) oprator it is the opposit of left Shift oprator it is called right Shift oprator in java script it is used to shift the veriable's value to right side in binary . it can shifts how many position we want we just need to set it . in this example we are going take x as a veriable and we are going to give its value x= 49 and now if we shift 2 position i will become 12 . the code will be (let x=49; x>>=2) and the result will be
EX 13
The zero fill right shift oprator (">>>=")
bits of a variable to the right by a specified number of positions and then store back the result into the veriable. in this case we are taking x as a example and we are giving its value 100 and shifting the bit's position by 3. so the code will be (let x=100; x>>>=3) . it will fill the leftmost positions with "0" and then the result will be
Sl. No | Oprator | Name | Use |
---|---|---|---|
1. | (&=) | Bitwise and assingment Oprator | this oprator is used to perform a bitwwise and opration it converts both veriable's value into their binary form then compare each bit of two veriables then if both bits are 1 then the result is 1 othert wise the resullt will be zero then it store the result into the veriable |
2. | (^=) | Bitwise XOR assingment Oprator | This Opraotr is used to perform a bitwise XOR opration Known as Exclusive OR oprator between two number then store the result back intko the first veriable |
3. | (|=) | Bitwise OR assingment Oprator | This Opraotr is used to perform a bitwise OR opration Known as OR oprator between two number then store the result back intko the first veriable if all bits are xero then the result will be zero if any bit is 1 then the result will be 1 |
The (&=) Opraotr
this is called bitwise And assingment Opraotr.it is basically an oprator which perform a bitwish and gate opration assume that we have 2 inputs like X=10 d Y= 7 if we assing this oprator the output will be will be z=x & Y. so z =
The (^=) oprator
in this example we are going to learn about the bitwise Xor gate oprator. it is basically an oprator which performs a bitwise Xor gate opration to the inputs and make a output . here we are going to take x=17, y=7, and perform a bitwise xor opration after that we assume that the output will be z and the value of z will be
The (|=) oprator
in this example we are going to learn about the bitwise OR assingment oprator . It is basically a oprator that performs a simple or gate oprations amoung the inputs assume that we hava x =10 , y=7, now if we perform the bitwise or opration then a output will arrive assume that it will be z so now the value of z will be
Sl.no | Oprator | Name | Use |
---|---|---|---|
1. | &&= | logical And assingment oprator | this oprator is used to oprate conditional programming or process the conditional assingment in a simple way . (it only works if the value is true) |
2. | ||= | Logical Or assingment oprator | This oprator is also used to process the |
3. | ??= | nullish coalescing assignment operator |
Comments
Post a Comment