String concat()
syntax: |
string.concat([string1, ...]) |
where: |
stringN - A list of strings to append to the end of the current object.
|
return: |
This method returns a string value (not a string object) consisting of the current object and any subsequent arguments appended to it.
|
description: |
This method creates a new string whose contents are equal to the current object. Each argument is then converted to a string using global.ToString() and appended to the newly created string. This value is then returned. Note that the original object remains unaltered. The '+' operator performs the same function.
|
see: |
|
example: |
// The following line:
var proverb = "A rolling stone " + "gathers no moss."
// creates the variable proverb and // assigns it the string // "A rolling stone gathers no moss." // If you try to concatenate a string with a number, // the number is converted to a string.
var newstring = 4 + "get it";
// This bit of code creates newstring as a string // variable and assigns it the string // "4get it".
// The use of the + operator is the standard way of // creating long strings in JavaScript. // In ScriptEase, the + operator is optional. // For example, the following:
var badJoke = "I was in front of an Italian " "restaurant waiting to get in when this guy " "came up and asked me, \"Why did the " "Italians lose the war?\" I told him I had " "no idea. \"Because they ordered ziti" "instead of shells,\" he replied."
// creates a long string containing // the entire bad joke. |