Assignment Operators JavaScript
Assignment Operators
On this page
Assignment Operator
Program to use Assignment Operators ( = ) JavaScript Language
let a = 5;
console.log('a =', a);
Output Addition
a = 5
Assignment Steps Description
- Declare variable a
- Initialize variable with value of a=5
- console.log inbuilt function की मदद्द से a variable की value को display किया गया हैं
Subtraction Assignment
Program to use Subtraction Assignment ( -= ) JavaScript Language
let b = 10
b -= 2;
console.log('b =', b);
Output Subtraction Assignment
b = 8
Subtraction Assignment Steps Description
- Declare variable b
- Initialise variable b with value of 10 b=10 with the help of assignment operator =
- value of variable b is subtracted with 2 and assigned using (-=) Subtraction Assignment
- console.log inbuilt function की मदद्द से b variable की value को display किया गया हैं
Addition Assignment
Program to use Addition Assignment ( += ) JavaScript Language
let c = 5;
c += 10;
console.log('c =', c);
Output Addition Assignment
c = 15
Addition Assignment Steps Description
- Declare variable c
- Initialise variable c with value of 5 c=5 with the help of assignment operator =
- value of variable c is sum with 10 and assigned using (+=) Addition Assignment
- console.log inbuilt function की मदद्द से c variable की value को display किया गया हैं
Multiplication Assignment
Program to use Multiplication Assignment ( *= ) JavaScript Language
let d = 10;
d *= 5;
console.log('d =', d);
Output Multiplication Assignment
d = 50
Multiplication Assignment Steps Description
- Declare variable d
- Initialise variable d with value of 10 d=10 with the help of assignment operator =
- value of variable d is multiplied with 5 and assigned using (*=) Multiplication Assignment
- console.log inbuilt function की मदद्द से d variable की value को display किया गया हैं
Division Assignment
Program to use Division Assignment ( /= ) JavaScript Language
let e = 20;
e /= 5;
console.log('e =',e);
Output Division Assignment
e = 4
Division Assignment Steps Description
- Declare variable e
- Initialise variable e with value of 20 e=20 with the help of assignment operator =
- value of variable e is divide with 5 and assigned using (/=) Division Assignment
- console.log inbuilt function की मदद्द से e variable की value को display किया गया हैं
Remainder Assignment
Program to use Remainder Assignment ( %= ) JavaScript Language
let f = 10;
f %= 3;
console.log('f =',f);
Output Remainder Assignment
f = 1
Remainder Assignment Steps Description
- Declare variable f
- Initialise variable f with value of 10 f=10 with the help of assignment operator =
- value of variable f is Remainder with 3 and assigned using (%=) Remainder Assignment
- console.log inbuilt function की मदद्द से f variable की value को display किया गया हैं
Exponentiation Assignment
Program to use Exponentiation Assignment ( **= ) JavaScript Language
let g = 5;
g **= 3;
console.log('g =',g);
Output Exponentiation Assignment
g = 125
Exponentiation Assignment Steps Description
- Declare variable f
- Initialise variable f with value of 10 f=10 with the help of assignment operator =
- value of variable f is Remainder with 3 and assigned using (%=) Remainder Assignment
- console.log inbuilt function की मदद्द से f variable की value को display किया गया हैं