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

write statement: · Part 5

Chapter 8: CHAPTER 14 · Computer Applications

the ability to concatenate strings. The + operator performs addition on numbers but also serves as the concatenation operator for strings. Because string concatenation has precedence over numeric addition, + will be interpreted as string concatenation if any of the operands are strings. + operator which is also called as the string concatenation operator.

For example: <Html> <Head> <Title>Demo Program - To Concatenating (+) Operators in JavaScript </Title> </Head> <Body> <script language="javascript" type="text/javascript"> var String1 = "Java"; var String2 = "Script"; var String3=String1+String2; document.write("<br>String1 : "+String1); document.write("<br>String2 : "+String2); document.write("<br><br>Concatenated String of String1 and String2 : "+String3); </script> </Body> </Html> Illustration . Using + Operator for concatenating String Output: . . Increment and Decrement Operators: The ++ operator increments its single operand.

The operator converts its operand to a number, adds to that number, and assigns the incremented value back into the variable. The return value of the ++ operator depends on its position relative to the operand. When ++ is used before the operand, where it is known as the pre-increment operator, it increments the operand and evaluates to the incremented value of that operand. When used after the operand, where it is known as the post-increment operator, it increments its operand but evaluates to the un-incremented value of that operand.

Consider the difference between these two lines of code: Chapter Pages var m = , n = ++m; // m and n are both var m = , n = m++; // m is , n is The -- operator decrements its single operand. It converts the value of the operand to a number, subtracts , and assigns the decremented value back to the operand. Like the ++ operator, the return value of -- depends on its position relative to the operand. When used before the operand, it decrements and returns the decremented value.

When used after the operand, it decrements the operand but returns the undecremented value. var m = , n = --m; // m and n are both var m = , n = m--;

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 →