Assignment Operators JavaScript

Program to use Assignment Operators ( = ) JavaScript Language


let a = 5;
console.log('a =', a);

Output


a = 5

Steps Description

  1. Declare variable a
  2. Initialize variable with value of a=5
  3. console.log inbuilt function की मदद्द से a variable की value को display किया गया हैं

Program to use Subtraction Assignment ( -= ) JavaScript Language


let b = 10
b -= 2;
console.log('b =', b);

Output


b = 8

Steps Description

  1. Declare variable b
  2. Initialise variable b with value of 10 b=10 with the help of assignment operator =
  3. value of variable b is subtracted with 2 and assigned using (-=) Subtraction Assignment
  4. console.log inbuilt function की मदद्द से b variable की value को display किया गया हैं

Program to use Addition Assignment ( += ) JavaScript Language


let c = 5;
c += 10;
console.log('c =', c);

Output


c = 15

Steps Description

  1. Declare variable c
  2. Initialise variable c with value of 5 c=5 with the help of assignment operator =
  3. value of variable c is sum with 10 and assigned using (+=) Addition Assignment
  4. console.log inbuilt function की मदद्द से c variable की value को display किया गया हैं

Program to use Multiplication Assignment ( *= ) JavaScript Language


let d = 10;
d *= 5;
console.log('d =', d);

Output


d = 50

Steps Description

  1. Declare variable d
  2. Initialise variable d with value of 10 d=10 with the help of assignment operator =
  3. value of variable d is multiplied with 5 and assigned using (*=) Multiplication Assignment
  4. console.log inbuilt function की मदद्द से d variable की value को display किया गया हैं

Program to use Division Assignment ( /= ) JavaScript Language


let e = 20;
e /= 5;
console.log('e =',e);

Output


e = 4

Steps Description

  1. Declare variable e
  2. Initialise variable e with value of 20 e=20 with the help of assignment operator =
  3. value of variable e is divide with 5 and assigned using (/=) Division Assignment
  4. console.log inbuilt function की मदद्द से e variable की value को display किया गया हैं

Program to use Remainder Assignment ( %= ) JavaScript Language


let f = 10;
f %= 3;
console.log('f =',f);

Output


f = 1

Steps Description

  1. Declare variable f
  2. Initialise variable f with value of 10 f=10 with the help of assignment operator =
  3. value of variable f is Remainder with 3 and assigned using (%=) Remainder Assignment
  4. console.log inbuilt function की मदद्द से f variable की value को display किया गया हैं

Program to use Exponentiation Assignment ( **= ) JavaScript Language


let g = 5;
g **= 3;
console.log('g =',g);

Output


g = 125

Steps Description

  1. Declare variable g
  2. Initialise variable g with value of 5 g=5 with the help of assignment operator =
  3. value of variable g is Exponentiation with 3 and assigned using (**=) Exponentiation Assignment
  4. console.log inbuilt function की मदद्द से g variable की value को display किया गया हैं