Jump to content

String append: Difference between revisions

Line 181:
{{works with|Rhino}}
{{works with|SpiderMonkey}}
<lang JavaScript>var ss1 = "Hello";
ss1 += ", World!";
print(ss1);</lang>
 
var s2 = "Goodbye";
// concat() returns the strings together, but doesn't edit existing string
// concat can also have multiple parameters
print(s2.concat(", World!"));</lang>
{{out}}
<pre>
"Hello, World!"
"Goodbye, World!"
</pre>
 
Cookies help us deliver our services. By using our services, you agree to our use of cookies.