From c7ee557d776d91998eeec005b6c794f03d6079ad Mon Sep 17 00:00:00 2001 From: Yanko1013 Date: Sat, 7 Dec 2024 06:56:34 +0800 Subject: [PATCH] string.concat() is not useful (#37122) * Update string/concat/index.md Add {{optional_inline}}, same as array/concat * Update index.md --------- Co-authored-by: Joshua Chen --- .../javascript/reference/global_objects/string/concat/index.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/files/en-us/web/javascript/reference/global_objects/string/concat/index.md b/files/en-us/web/javascript/reference/global_objects/string/concat/index.md index 2a2542db4a6f9f5..3764784b30a5b1c 100644 --- a/files/en-us/web/javascript/reference/global_objects/string/concat/index.md +++ b/files/en-us/web/javascript/reference/global_objects/string/concat/index.md @@ -15,7 +15,6 @@ the string arguments to this string and returns a new string. ## Syntax ```js-nolint -concat() concat(str1) concat(str1, str2) concat(str1, str2, /* …, */ strN) @@ -24,7 +23,7 @@ concat(str1, str2, /* …, */ strN) ### Parameters - `str1`, …, `strN` - - : One or more strings to concatenate to `str`. + - : One or more strings to concatenate to `str`. Though technically permitted, calling `String.prototype.concat()` with no arguments is a useless operation, because it does not result in observable copying (like {{jsxref("Array.prototype.concat()")}}), since strings are immutable. It should only happen if you are [spreading](/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax) an array of strings as arguments, and that array happens to be empty. ### Return value