diff options
Diffstat (limited to 'files/uk/web/javascript/reference/operators/less_than/index.html')
| -rw-r--r-- | files/uk/web/javascript/reference/operators/less_than/index.html | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/files/uk/web/javascript/reference/operators/less_than/index.html b/files/uk/web/javascript/reference/operators/less_than/index.html new file mode 100644 index 0000000000..9833b8532e --- /dev/null +++ b/files/uk/web/javascript/reference/operators/less_than/index.html @@ -0,0 +1,99 @@ +--- +title: Менше ніж (<) +slug: Web/JavaScript/Reference/Operators/Less_than +tags: + - JavaScript + - Довідка + - Оператор +translation_of: Web/JavaScript/Reference/Operators/Less_than +--- +<div>{{jsSidebar("Operators")}}</div> + +<p>Оператор менше ніж (<code><</code>) повертає <code>true</code>, якщо значення лівого операнда менше за значення правого операнда, інакше повертає <code>false</code>.</p> + +<div>{{EmbedInteractiveExample("pages/js/expressions-less-than.html")}}</div> + + + +<h2 id="Синтаксис">Синтаксис</h2> + +<pre class="syntaxbox notranslate"> x < y</pre> + +<h2 id="Опис">Опис</h2> + +<p>Операнди порівнюються за допомогою алгоритму <a class="external external-icon" href="https://tc39.es/ecma262/#sec-abstract-relational-comparison" rel="noopener">абстрактного порівняння</a>. Дивіться опис алгоритму у документації оператора <a href="/uk/docs/Web/JavaScript/Reference/Operators/Greater_than">більше ніж</a>.</p> + +<h2 id="Приклади">Приклади</h2> + +<h3 id="Порівняння_рядків">Порівняння рядків</h3> + +<pre class="brush: js notranslate">console.log("а" < "б"); // true +console.log("а" < "а"); // false +console.log("а" < "3"); // false</pre> + +<h3 id="Порівняння_рядка_з_числом">Порівняння рядка з числом</h3> + +<pre class="brush: js notranslate">console.log("5" < 3); // false +console.log("3" < 3); // false +console.log("3" < 5); // true + +console.log("привіт" < 5); // false +console.log(5 < "привіт"); // false + +console.log("5" < 3n); // false +console.log("3" < 5n); // true</pre> + +<h3 id="Порівняння_числа_з_числом">Порівняння числа з числом</h3> + +<pre class="brush: js notranslate">console.log(5 < 3); // false +console.log(3 < 3); // false +console.log(3 < 5); // true</pre> + +<h3 id="Порівняння_числа_з_BigInt">Порівняння числа з BigInt</h3> + +<pre class="brush: js notranslate">console.log(5n < 3); // false +console.log(3 < 5n); // true</pre> + +<h3 id="Порівняння_Boolean_null_undefined_NaN">Порівняння Boolean, null, undefined, NaN</h3> + +<pre class="brush: js notranslate">console.log(true < false); // false +console.log(false < true); // true + +console.log(0 < true); // true +console.log(true < 1); // false + +console.log(null < 0); // false +console.log(null < 1); // true + +console.log(undefined < 3); // false +console.log(3 < undefined); // false + +console.log(3 < NaN); // false +console.log(NaN < 3); // false</pre> + +<h2 id="Специфікації">Специфікації</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Специфікація</th> + </tr> + <tr> + <td>{{SpecName('ESDraft', '#sec-relational-operators', 'Relational operators')}}</td> + </tr> + </tbody> +</table> + +<h2 id="Сумісність_з_веб-переглядачами">Сумісність з веб-переглядачами</h2> + + + +<p>{{Compat("javascript.operators.less_than")}}</p> + +<h2 id="Див._також">Див. також</h2> + +<ul> + <li><a href="/uk/docs/Web/JavaScript/Reference/Operators/Greater_than">Оператор більше ніж</a></li> + <li><a href="/uk/docs/Web/JavaScript/Reference/Operators/Greater_than_or_equal">Оператор більше чи дорівнює</a></li> + <li><a href="/uk/docs/Web/JavaScript/Reference/Operators/Less_than_or_equal">Оператор менше чи дорівнює</a></li> +</ul> |
