aboutsummaryrefslogtreecommitdiff
path: root/files/vi/tu-dien-thuat-ngu/falsy/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/vi/tu-dien-thuat-ngu/falsy/index.html')
-rw-r--r--files/vi/tu-dien-thuat-ngu/falsy/index.html32
1 files changed, 32 insertions, 0 deletions
diff --git a/files/vi/tu-dien-thuat-ngu/falsy/index.html b/files/vi/tu-dien-thuat-ngu/falsy/index.html
new file mode 100644
index 0000000000..c71e9cc197
--- /dev/null
+++ b/files/vi/tu-dien-thuat-ngu/falsy/index.html
@@ -0,0 +1,32 @@
+---
+title: Falsy
+slug: Tu-dien-thuat-ngu/Falsy
+translation_of: Glossary/Falsy
+---
+<p id="Summary">Giá trị <strong>falsy</strong> là giá trị được hiểu là <em>false</em> trong ngữ cảnh {{Glossary("Boolean")}}.</p>
+
+<p>{{Glossary("JavaScript")}} sử dụng {{Glossary("Type_Conversion", "Type Conversion")}} để ép kiểu giá trị bất kì thành Boolean khi cần thiết, ví dụ trong mệnh đề điều kiện ({{Glossary("Conditional", "conditionals")}}) và vòng lặp ({{Glossary("Loop", "loops")}}).</p>
+
+<h2 id="Ví_dụ">Ví dụ</h2>
+
+<p>Sau đây là ví dụ về các giá trị <em>falsy</em> (sẽ được hiểu là 'false' dẫn đến không thực hiện đoạn code của <code>if</code> ):</p>
+
+<pre class="brush: js">if (false)
+if (null)
+if (undefined)
+if (0)
+if (NaN)
+if ('')
+if ("")
+if (document.all) [1]</pre>
+
+<p>[1] <code>document.all</code> trước đây được sử dụng trong việc nhận biết trình duyệt và tài liệu <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/obsolete.html#dom-document-all">HTML specification defines a willful violation</a> của chuẩn ECMAScript này để tương thích với code cũ (<code>if (document.all) { // Internet Explorer code here }</code> hoặc sử dụng <code>document.all</code> mà không kiểm tra trước về sự tồn tại của nó: <code>document.all.foo</code>).</p>
+
+<p>Đôi khi từ này được viết là <strong>falsey</strong>.</p>
+
+<h2 id="Tìm_hiểu_thêm">Tìm hiểu thêm</h2>
+
+<ul>
+ <li>{{Glossary("Truthy")}}</li>
+ <li>{{Glossary("Boolean")}}</li>
+</ul>