📖 Samacheer Kalvi · 11th TN - English Medium · Computer Applications · Page 304question

write statement: · Part 2

Chapter 8: CHAPTER 14 · Computer Applications

var value1 = , value2= ; document.write("<br>Data1 : "+value1); document.write("<br>Data2 : "+value2); var sum = value1+value2; var diff = value1-value2; var prod = value1*value2; var res = value1/value2; var rem = value1%value2; document.write("<br><br>The Sum of Data1 and Data2 : "+sum); document.write("<br>The Difference of Data1 and Data2 : "+diff); document.write("<br>The Product of Data1 and Data2 : "+prod); document.write("<br>The Result after Division of Data1 and Data2 : "+res); document.write("<br>The Remainder after Division of Data1 and Data2 : "+rem); </script> </Body> </Html> Output: . . Assignment Operator An assignment operator is the operator used to assign a new value to a variable. Assignment operator can also be used for logical operations such as bitwise logical operations or operations on integral operands and Boolean operands.

In JavaScript = is an assignment operator, which is used to assign a value to a variable. Often this operator is used to set a variable to a literal value, for example, var number1= ; var number2=number1; var name=”Computer Science”; var booleanvar=true; The assignment operator is used to assign a value to a single variable, but it is possible to perform multiple assignments at once by stringing them together with the = operator. For example, the statement Chapter Pages var m = n = z = ; // sets all three variables to a value of // The assignment operator can also be used to set a variable to hold the value of an expression. For example, var x = + - ; // x set to // JavaScript supports some shorthand arithmetic operators like +=, -=, *=, /= and %= to evaluate arithmetic calculations.

Table: . Shorthand Arithmetic operators Shorthand Arithmetic Operator Meaning Example Result += Add and assign var sum = ; sum += ; Variable sum = -= Subtract and assign var diff = ; diff –= ; Variable diff = *= Multiply and assign var prod = ; prod *= ; Variable prod = /= Division Var res = ; Res/= Variable res = . %= Modulus operator Var rem = ;

Related topics

Have a question about this topic?

Get an AI answer grounded in your actual textbook — with the exact page reference.

Ask AI about this topic →