diff options
| author | Ryan Johnson <rjohnson@mozilla.com> | 2021-04-29 16:16:42 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-29 16:16:42 -0700 |
| commit | 95aca4b4d8fa62815d4bd412fff1a364f842814a (patch) | |
| tree | 5e57661720fe9058d5c7db637e764800b50f9060 /files/vi/web/javascript/reference/global_objects/math/floor | |
| parent | ee3b1c87e3c8e72ca130943eed260ad642246581 (diff) | |
| download | translated-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/math/floor')
| -rw-r--r-- | files/vi/web/javascript/reference/global_objects/math/floor/index.html | 132 |
1 files changed, 0 insertions, 132 deletions
diff --git a/files/vi/web/javascript/reference/global_objects/math/floor/index.html b/files/vi/web/javascript/reference/global_objects/math/floor/index.html deleted file mode 100644 index 2f660fcf00..0000000000 --- a/files/vi/web/javascript/reference/global_objects/math/floor/index.html +++ /dev/null @@ -1,132 +0,0 @@ ---- -title: Math.floor() -slug: Web/JavaScript/Reference/Global_Objects/Math/floor -translation_of: Web/JavaScript/Reference/Global_Objects/Math/floor ---- -<div>{{JSRef}}</div> - -<p>Hàm <strong><code>Math.floor()</code></strong> trả về số nguyên bé hơn hoặc bằng số ban đầu.</p> - -<div>{{EmbedInteractiveExample("pages/js/math-floor.html")}}</div> - - - -<h2 id="Cú_pháp">Cú pháp</h2> - -<pre class="syntaxbox notranslate">Math.floor(<var>x</var>)</pre> - -<h3 id="Tham_số">Tham số</h3> - -<dl> - <dt><code>x</code></dt> - <dd>Một số.</dd> -</dl> - -<h3 id="Giá_trị_trả_về">Giá trị trả về</h3> - -<p>Số nguyên lớn nhất nhỏ hơn hoặc bằng số đã cho.</p> - -<h2 id="Mô_tả">Mô tả</h2> - -<p>Bởi vì <code>floor()</code> là một phương thức tĩnh của <code>Math</code>, bạn luôn sử dụng <code>Math.floor()</code>, thay vì sử dụng như là một phương thức của đối tượng được tạo ra từ <code>Math</code> (<code>Math</code> không phải là một constructor).</p> - -<div class="blockIndicator note"> -<p><strong>Lưu ý: </strong><code>Math.floor(null)</code> trả về 0, không phải {{jsxref("NaN")}}.</p> -</div> - -<h2 id="Ví_dụ">Ví dụ</h2> - -<h3 id="Sử_dụng_Math.floor">Sử dụng <code>Math.floor()</code></h3> - -<pre class="brush: js notranslate">Math.floor( 45.95); // 45 -Math.floor( 45.05); // 45 -Math.floor( 4 ); // 4 -Math.floor(-45.05); // -46 -Math.floor(-45.95); // -46 -</pre> - -<h3 id="Điều_chỉnh_thập_phân">Điều chỉnh thập phân</h3> - -<pre class="brush: js notranslate">/** - * Decimal adjustment of a number. - * - * @param {String} type The type of adjustment. - * @param {Number} value The number. - * @param {Integer} exp The exponent (the 10 logarithm of the adjustment base). - * @returns {Number} The adjusted value. - */ -function decimalAdjust(type, value, exp) { - // If the exp is undefined or zero... - if (typeof exp === 'undefined' || +exp === 0) { - return Math[type](value); - } - value = +value; - exp = +exp; - // If the value is not a number or the exp is not an integer... - if (isNaN(value) || !(typeof exp === 'number' && exp % 1 === 0)) { - return NaN; - } - // Shift - value = value.toString().split('e'); - value = Math[type](+(value[0] + 'e' + (value[1] ? (+value[1] - exp) : -exp))); - // Shift back - value = value.toString().split('e'); - return +(value[0] + 'e' + (value[1] ? (+value[1] + exp) : exp)); -} - -// Decimal round -const round10 = (value, exp) => decimalAdjust('round', value, exp); -// Decimal floor -const floor10 = (value, exp) => decimalAdjust('floor', value, exp); -// Decimal ceil -const ceil10 = (value, exp) => decimalAdjust('ceil', value, exp); - -// Round -round10(55.55, -1); // 55.6 -round10(55.549, -1); // 55.5 -round10(55, 1); // 60 -round10(54.9, 1); // 50 -round10(-55.55, -1); // -55.5 -round10(-55.551, -1); // -55.6 -round10(-55, 1); // -50 -round10(-55.1, 1); // -60 -// Floor -floor10(55.59, -1); // 55.5 -floor10(59, 1); // 50 -floor10(-55.51, -1); // -55.6 -floor10(-51, 1); // -60 -// Ceil -ceil10(55.51, -1); // 55.6 -ceil10(51, 1); // 60 -ceil10(-55.59, -1); // -55.5 -ceil10(-59, 1); // -50 -</pre> - -<h2 id="Quy_cách_kỹ_thuật">Quy cách kỹ thuật</h2> - -<table class="standard-table"> - <tbody> - <tr> - <th scope="col">Specification</th> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-math.floor', 'Math.floor')}}</td> - </tr> - </tbody> -</table> - -<h2 id="Trình_duyệt_tương_thích">Trình duyệt tương thích</h2> - - - -<p>{{Compat("javascript.builtins.Math.floor")}}</p> - -<h2 id="Xem_thêm">Xem thêm:</h2> - -<ul> - <li>{{jsxref("Math.abs()")}}</li> - <li>{{jsxref("Math.ceil()")}}</li> - <li>{{jsxref("Math.round()")}}</li> - <li>{{jsxref("Math.sign()")}}</li> - <li>{{jsxref("Math.trunc()")}}</li> -</ul> |
