String Operators In Java Script

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.
 
 
Operator Description Example
+ This operator joins the string at left hand side with the string at right hand side A=”India”
B=”Gate”
C=A+B – C is holding a value
IndiaGate
 
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
Scroll to Top