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 |
---|---|---|---|
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 .
Comments
Post a Comment