A string operator joins two string values of two string variables and creates a third string value. String operators concatenates two strings. Even the value is numeric in a string variable it is also concatenated. | ||||||
Like “20” + “30” | ||||||
the answer will be 2030, not 50. | ||||||
|
||||||
Example | ||||||
<html>
<head> </head> <body> <script type=”text/javascript”> var a=” India “ var b = “Gate” var c= a+b document.write(“<br>Value of a “+a); document.write(“<br>Value of b “+b); document.write(“<br>Value of c “+c); </script > </body> </html> |
||||||
Output: | ||||||
Value of a India Value of b Gate Value of c IndiaGate |