String Operators

String Operators
39
1/1





String Operators
The most useful operator for strings is concatenation, represented by the + sign.
Concatenation can be used to build strings by joining together multiple strings, or by joining strings with other types:
The above example declares and initializes two string variables, and then concatenates them.
Numbers in quotes are treated as strings: "42" is not the number 42, it is a stringthat includes two characters, 4 and 2.
What is the output of the following code:
var x = "50";
var y = "100";
document.write(x+y);
var x = "50";
var y = "100";
document.write(x+y);
Comments
Post a Comment