aboutsummaryrefslogtreecommitdiff
path: root/files/vi/web/javascript/reference/global_objects/string/repeat
diff options
context:
space:
mode:
authorRyan Johnson <rjohnson@mozilla.com>2021-04-29 16:16:42 -0700
committerGitHub <noreply@github.com>2021-04-29 16:16:42 -0700
commit95aca4b4d8fa62815d4bd412fff1a364f842814a (patch)
tree5e57661720fe9058d5c7db637e764800b50f9060 /files/vi/web/javascript/reference/global_objects/string/repeat
parentee3b1c87e3c8e72ca130943eed260ad642246581 (diff)
downloadtranslated-content-95aca4b4d8fa62815d4bd412fff1a364f842814a.tar.gz
translated-content-95aca4b4d8fa62815d4bd412fff1a364f842814a.tar.bz2
translated-content-95aca4b4d8fa62815d4bd412fff1a364f842814a.zip
remove retired locales (#699)
Diffstat (limited to 'files/vi/web/javascript/reference/global_objects/string/repeat')
-rw-r--r--files/vi/web/javascript/reference/global_objects/string/repeat/index.html118
1 files changed, 0 insertions, 118 deletions
diff --git a/files/vi/web/javascript/reference/global_objects/string/repeat/index.html b/files/vi/web/javascript/reference/global_objects/string/repeat/index.html
deleted file mode 100644
index 72e2179cf1..0000000000
--- a/files/vi/web/javascript/reference/global_objects/string/repeat/index.html
+++ /dev/null
@@ -1,118 +0,0 @@
----
-title: String.prototype.repeat()
-slug: Web/JavaScript/Reference/Global_Objects/String/repeat
-tags:
- - Chuỗi
- - ES6
- - Phương Thức
- - Tham khảo
-translation_of: Web/JavaScript/Reference/Global_Objects/String/repeat
----
-<div>{{JSRef}}</div>
-
-<p>Phương thức <strong><code>repeat()</code></strong> xây dựng và trả về một chuỗi mới chứa số lượng nhất định bản sao chép của chuỗi được gọi tới và nối chung với nhau.</p>
-
-<h2 id="Cú_pháp">Cú pháp</h2>
-
-<pre class="syntaxbox"><code><var>str</var>.repeat(<var>count</var>);</code>
-</pre>
-
-<h3 id="Tham_số">Tham số</h3>
-
-<dl>
- <dt><code>count</code></dt>
- <dd>Là 0 hoặc số nguyên dương, tức là giá trị nằm trong khoảng: [0, +∞), xác định số lần lặp để tạo chuỗi mới.</dd>
-</dl>
-
-<h3 id="Giá_trị_trả_về">Giá trị trả về</h3>
-
-<p>Một chuỗi mới chứa số lần sao chép (count) chuỗi đầu vào.</p>
-
-<h3 id="Ngoại_lệ">Ngoại lệ</h3>
-
-<ul>
- <li>{{jsxref("Errors/Negative_repetition_count", "RangeError")}}: số lần lặp phải không âm.</li>
- <li>{{jsxref("Errors/Resulting_string_too_large", "RangeError")}}: số lần lặp phải nhỏ hơn vô cực và không vượt kích cỡ chuỗi tối đa.</li>
-</ul>
-
-<h2 id="Ví_dụ">Ví dụ</h2>
-
-<pre class="brush: js">'abc'.repeat(-1); // RangeError
-'abc'.repeat(0); // ''
-'abc'.repeat(1); // 'abc'
-'abc'.repeat(2); // 'abcabc'
-'abc'.repeat(3.5); // 'abcabcabc' (tham số đếm sẽ được chuyển thành số nguyên)
-'abc'.repeat(1/0); // RangeError
-
-({ toString: () =&gt; 'abc', repeat: String.prototype.repeat }).repeat(2);
-// 'abcabc' (repeat() is a generic method)
-</pre>
-
-<h2 id="Polyfill">Polyfill</h2>
-
-<p>Phương thức này đã được thêm vào kỹ thuật ES6 và có thể chưa có sẵn trong tất cả các bản bổ sung JS. Tuy nhiên bạn có thể sử dụng polyfill <code>String.prototype.repeat()</code> với snippet dưới đây:</p>
-
-<pre class="brush: js">if (!String.prototype.repeat) {
- String.prototype.repeat = function(count) {
- 'use strict';
- if (this == null) {
- throw new TypeError('can\'t convert ' + this + ' to object');
- }
- var str = '' + this;
- count = +count;
- if (count != count) {
- count = 0;
- }
- if (count &lt; 0) {
- throw new RangeError('repeat count must be non-negative');
- }
- if (count == Infinity) {
- throw new RangeError('repeat count must be less than infinity');
- }
- count = Math.floor(count);
- if (str.length == 0 || count == 0) {
- return '';
- }
-
- // Đảm bảo tham số đếm là số nguyên 31 bít cho phép ta tối ưu hóa nhiều
- // phần chính. Nhưng dù sao thì, hầu hết các trình duyệt hiện tại (tháng Tám năm 2014) không thể xử lý
- // các chuỗi 1 &lt;&lt; 28 chars hoặc lớn hơn, vậy nên:
- if (str.length * count &gt;= 1 &lt;&lt; 28) {
- throw new RangeError('repeat count must not overflow maximum string size');
- }
- var rpt = '';
- for (var i = 0; i &lt; count; i++) {
- rpt += str;
- }
- return rpt;
- }
-}
-</pre>
-
-<h2 id="Thông_số">Thông số</h2>
-
-<table class="standard-table">
- <tbody>
- <tr>
- <th scope="col">Specification</th>
- <th scope="col">Status</th>
- <th scope="col">Comment</th>
- </tr>
- <tr>
- <td>{{SpecName('ES2015', '#sec-string.prototype.repeat', 'String.prototype.repeat')}}</td>
- <td>{{Spec2('ES2015')}}</td>
- <td>Định nghĩa bổ sung.</td>
- </tr>
- <tr>
- <td>{{SpecName('ESDraft', '#sec-string.prototype.repeat', 'String.prototype.repeat')}}</td>
- <td>{{Spec2('ESDraft')}}</td>
- <td> </td>
- </tr>
- </tbody>
-</table>
-
-<h2 id="Tương_thích_trình_duyệt">Tương thích trình duyệt</h2>
-
-<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>
-
-<p>{{Compat("javascript.builtins.String.repeat")}}</p>