Assignment Operators javascript In Hindi

Assignment Operators in javascript In Hindi

जावास्क्रिप्ट प्रोग्रामिंग में असाइनमेंट ऑपरेटर का उपयोग मल्टीप्ल प्रोग्राम में डिक्लेअर वैरिएबल को वैल्यू असाइन करने में किया जाता है। किसी भी जावास्क्रिप्ट प्रोग्राम में असाइनमेंट ऑपरेटर यूजर डिक्लेअर वैरिएबल में वैल्यू को डिक्लेअर कर असाइन या अपडेट करने में किया जाता हैं। जहा सबसे अधिक उपयोगी असाइनमेंट इक्वल ऑपरेटर = है, यहाँ आपको जावास्क्रिप्ट में कई प्रकार के असाइनमेंट ऑपरेटर विकल्प मिलते है. जिससे की आप असाइनमेंट ऑपरेटर का उपयोग कर कई मैथमेटिकल ऑपरेशन, जैसे नंबर जोड़ना, सब्ट्रैक्ट करना, मल्टिप्लाय करना, डिवीज़न, मॉडुलुस, और एक्सपोनेंशियल वैल्यू , आदि ऑपरेशन को परफॉर्म कर सकते है।

Assignment Operators javascript In Hindi

Basic assignment operator (=) operator.

सबसे बुनियादी असाइनमेंट ऑपरेटर इक्वल = है, जिसका उपयोग यूजर डिक्लेअर वैरिएबल को वैल्यू असाइन करने में किया जाता है।

Basic assignment operator (=) operator syntax.

let variable = value;

Example of assignment operator (=) operator.

let p = 22; // यहाँ वैरिएबल p को वैल्यू 22 असाइन किया गया है.

let q = 31; // यहाँ वैरिएबल q को वैल्यू 31 असाइन किया गया है

Addition assignment (+=) operator.

यहाँ ऐड असाइनमेंट += ऑपरेटर मौजूदा जावास्क्रिप्ट प्रोग्राम में राइट ऑपरेंड को लेफ्ट ऑपरेंड में ऐड कर प्रीव्यू करता है, और इसके रिजल्ट को लेफ्ट ऑपरेंड में असाइन करता है।

Addition assignment (+=) operator syntax.

declare_variable += value;

Example of Addition assignment (+=) operator.

let p = 4;

p += 10; // p = p + 10 (4 + 10)

console.log(p); // Result – 14

Subtraction assignment (-=) operator.

जावास्क्रिप्ट प्रोग्राम में सुब्स्ट्रक्ट असाइनमेंट -= ऑपरेटर राइट ऑपरेंड से लेफ्ट ऑपरेंड से सब्सट्रैक्ट करता है, और रिजल्ट को लेफ्ट ऑपरेंड को असाइन करता है।

Subtraction assignment (-=) operator syntax.

declare_variable -= value;

Example of subtraction assignment (-=) operator.

let p = 8;

p -= 2; // p = p – 2 (8 – 2)

console.log(p); // Result – 6

Multiplication assignment (*=) operator.

जावास्क्रिप्ट प्रोग्राम में मल्टिप्लिकेशन *= ऑपरेटर लेफ्ट ऑपरेंड को राइट ऑपरेंड से मल्टिप्लाय करता है, और वेरिएबल वैल्यू के मल्टिप्लिकेशन रिजल्ट को लेफ्ट ऑपरेंड को आउटपुट वैल्यू असाइन करता है।

Syntax of the multiplication assignment (*=) operator.

decalre_variable *= value;

Example of the multiplication assignment (*=) operator.

let p = 4;

p *= 3; // p = p * 3 (4 * 3)

console.log(p); // result – 12

Division assignment (/=) operator.

डिवीज़न असाइनमेंट /= ऑपरेटर लेफ्ट ऑपरेंड को राइट ऑपरेंड से डिवाइड करता है, और रिजल्ट को लेफ्ट ऑपरेंड में असाइन करता है।

Syntax of the division assignment (/=) operator.

declare_variable /= value;

Example of the division assignment (/=) operator.

let p = 25;

p /= 5; // p = p / 5 (25 / 5)

console.log(p); // result – 5

Remainder (modulo) assignment (%=) operator.

जावास्क्रिप्ट प्रोग्राम में %= ऑपरेटर लेफ्ट ऑपरेंड को राइट ऑपरेंड से डिवाइड करता है, और दोनों के डिवीज़न के मॉडुलुस को लेफ्ट ऑपरेंड में असाइन कर देता है।

The syntax of the remainder (modulo) assignment (%=) operator.

declare_variable %= value;

Example of the remainder (modulo) assignment (%=) operator.

let p = 11;

p %= 3; // p = p % 3 (11 % 3)

console.log(p); // result – 2 (remainder of 11 divided by 3 is 2)

Exponentiation (**=) operator.

जावास्क्रिप्ट प्रोग्राम में एक्सपोनेंट **= ऑपरेटर लेफ्ट ऑपरेंड को राइट ऑपरेंड की घातांक वैल्यू को बढ़ाता है, और इसके रिजल्ट को लेफ्ट ऑपरेंड को वैल्यू में असाइन करता है।

Syntax of exponentiation (**=) operator.

declare_variable **= value;

Example of exponentiation (**=) operator.

let p = 2;

p **= 4;  // p = p ** 3 (2 ** 4)

console.log(p);  // result – 16 (2 raised to the power of 4 and result is 16)

JavaScript assignment operator Summary.

OperatorDescriptionExampleResult
=Equal Assigns operator used to a value to a variablep = 1;p is 1
+=Add assignment operator used to Adds the right operand to the left operandp += 3;p is p + 3
-=Subtract assignment operator used to Subtracts the right operand from the left operandp -= 4;p is p – 4
*=Multiply assignment operator used to Multiplies the left operand by the right operandp *= 5;p is p * 5
/=Division assignment operator used to Divides the left operand by the right operandp /= 3;p is p / 3
%=Remainder assignment operator used to Assigns the remainder of the divisionp %= 2;p is p % 2
**=Exponent assignment operator used to Raises the left operand to the power of the right operandp **= 3;p is p **

So let’s see the example of using multiple assignment operator in JavaScript programming.

Example of combination of JavaScript multiple assignment operator.

let p = 7;

p += 2; // p = 7 + 2 -> p = 9

p -= 3; // p = 7 – 3 -> p = 4

p *= 2; // p = 7 * 2 -> p = 14

p /= 4; // p = 2 / 4 -> p = 1.75

p %= 5; // p = 7 % 5 -> p = 2

p **= 2; // p = 1 ** 2 -> p = 49

console.log(p); // result – 9

JavaScript Assignment Operator Conclusion.

जावास्क्रिप्ट प्रोग्रामिंग में असाइनमेंट ऑपरेटर मल्टीप्ल प्रोग्राम ऑपरेशन के साथ किसी वेरिएबल के वैल्यू को अपडेट या मॉडिफाई करना आसान करते हैं। जहा p = p + 7 जैसे डिटेल एक्सप्रेशन क्रिएट करने के बजाय, जावास्क्रिप्ट प्रोग्रामर इक्वल रिजल्ट (p += 7) अचीव करने के लिए बस ऐड अरिथमेटिक असाइनमेंट += ऑपरेटर का इस्तेमाल कर सकते हैं।