-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
translation(js): Web/JavaScript/Reference/Global_Objects/String/concat (
#198) * translation(js): Web/JavaScript/Reference/Global_Objects/String/concat * Apply suggestions from code review Co-authored-by: Vitalii Perehonchuk <[email protected]> Co-authored-by: Vitalii Perehonchuk <[email protected]>
- Loading branch information
1 parent
db70ad9
commit b8a622e
Showing
1 changed file
with
77 additions
and
0 deletions.
There are no files selected for viewing
77 changes: 77 additions & 0 deletions
77
files/uk/web/javascript/reference/global_objects/string/concat/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
--- | ||
title: String.prototype.concat() | ||
slug: Web/JavaScript/Reference/Global_Objects/String/concat | ||
tags: | ||
- JavaScript | ||
- Method | ||
- Prototype | ||
- Reference | ||
- String | ||
browser-compat: javascript.builtins.String.concat | ||
--- | ||
{{JSRef}} | ||
|
||
Метод **`concat()`** (конкатенація) приєднує рядкові аргументи до рядка, на якому викликається, і повертає результат як новий рядок. | ||
|
||
{{EmbedInteractiveExample("pages/js/string-concat.html")}} | ||
|
||
## Синтаксис | ||
|
||
```js | ||
concat(str1) | ||
concat(str1, str2) | ||
concat(str1, str2, ... , strN) | ||
``` | ||
|
||
### Параметри | ||
|
||
- `strN` | ||
- : Один чи більше рядків, які слід приєднати до початкового рядка `str`. | ||
|
||
### Повернене значення | ||
|
||
Новий рядок, що містить всі передані рядки, з'єднані в один. | ||
|
||
## Опис | ||
|
||
Функція `concat()` приєднує передані в аргументах рядки до рядка, на якому викликається, і повертає результат як новий рядок. Зміни до початкового чи поверненого рядків не впливають на інші залучені рядки. | ||
|
||
Якщо передані аргументи не є рядками, їх буде зведено до рядкового типу безпосередньо перед конкатенацією. | ||
|
||
## Швидкодія | ||
|
||
Наполегливо рекомендується вживати {{jsxref("Operators/Assignment_Operators", "оператори присвоєння", "", 1)}} (`+`, `+=`) замість методу `concat()`. | ||
|
||
## Приклади | ||
|
||
### Застосування concat() | ||
|
||
Наступний приклад поєднує два рядки в один новий. | ||
|
||
```js | ||
let hello = 'Привіт, ' | ||
console.log(hello.concat('Кевіне', '. Гарного дня.')) | ||
// Привіт, Кевіне. Гарного дня. | ||
|
||
let greetList = ['Привіт', ' ', 'Венкате', '!'] | ||
"".concat(...greetList) // "Привіт Венкате!" | ||
|
||
"".concat({}) // [object Object] | ||
"".concat([]) // "" | ||
"".concat(null) // "null" | ||
"".concat(true) // "true" | ||
"".concat(4, 5) // "45" | ||
``` | ||
|
||
## Специфікації | ||
|
||
{{Specifications}} | ||
|
||
## Сумісність із браузерами | ||
|
||
{{Compat}} | ||
|
||
## Дивіться також | ||
|
||
- {{jsxref("Array.prototype.concat()")}} | ||
- {{jsxref("Operators/Assignment_Operators", "Оператори присвоєння", "", 1)}} |