Notes
The +
operator can also be used to concatenate strings.
let txtA= "Will";
let txtB= "Smith";
let text3 = txtA + " " + txtB;
Output: Will Smith
The += assignment operator can also be used to concatenate strings:
let txt= "Will ";
let txt += "Smith";
document.write(txt);
Output: Will Smith
If you add a number and a string, the result will be a string!
let x = "1" + 1;
document.write(x)
Output: 11