Capturing groups by SamGreenberg · Pull Request #441 · javascript-tutorial/uk.javascript.info

dolgachio

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Дякую за переклад і ваш внесок! Я додав кілька коментарів до тексту, з вашого боку нічого більше не треба, я сам внесу необхідні зміни


```js run
let str = "Gogogo John!";
let str = "Gogogo Іван!";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let str = "Gogogo Іван!";
let str = "Gogogo John!";
alert( result[0] ); // Gogogo John (full match)
alert( result[1] ); // John
alert( result.length ); // 2 (no more items in the array)
alert( result[0] ); // Gogogo Іван (повний збіг)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alert( result[0] ); // Gogogo Іван (повний збіг)
alert( result[0] ); // Gogogo John (повний збіг)
alert( result[1] ); // John
alert( result.length ); // 2 (no more items in the array)
alert( result[0] ); // Gogogo Іван (повний збіг)
alert( result[1] ); // Іван

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alert( result[1] ); // Іван
alert( result[1] ); // John
alert( result.length ); // 2 (no more items in the array)
alert( result[0] ); // Gogogo Іван (повний збіг)
alert( result[1] ); // Іван
alert( result.length ); // 2 (інших елементів у масиві нема)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alert( result.length ); // 2 (інших елементів у масиві нема)
alert( result.length ); // 2 (інших елементів у масиві немає)

- The method `str.match` returns capturing groups only without flag `pattern:g`.
- The method `str.matchAll` always returns capturing groups.
- Метод `str.match` повертає групи захоплення лише без прапору `pattern:g`.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- Метод `str.match` повертає групи захоплення лише без прапору `pattern:g`.
- Метод `str.match` повертає групи захоплення лише без прапорцю `pattern:g`.