- If one of the given operands is of string type, then the (+) operator acts as a concatenation operator
- If both operands are of number type, then the (+) operator acts as an addition operator.
document.write("Wonder"+"Develop"); // WonderDevelop document.write("number"+10); // number10 document.write(10+"column"); //10column document.write(15+15); //30
Concatenate string and variable
let fav="Peacock"; document.write("My favourite bird is "+fav); // My favourite bird is Peacock;
In the above code, the string is stored in the “fav” variable And the string fav is Concatenated by giving some text in the print statement.