HTML Diff
1 added 3 removed
Original 2026-01-01
Modified 2026-02-26
1 <h2>Ответы</h2>
1 <h2>Ответы</h2>
2 <p>Для того, чтобы проверить является ли переменная массивом, можно воспользоваться встроенным методом Array.isArray().</p>
2 <p>Для того, чтобы проверить является ли переменная массивом, можно воспользоваться встроенным методом Array.isArray().</p>
3 - <p>0</p>
 
4 <p>Предлагаю воспользоваться оператором<strong>instanceof</strong>:</p>
3 <p>Предлагаю воспользоваться оператором<strong>instanceof</strong>:</p>
5 <h4>Документация:</h4>
4 <h4>Документация:</h4>
6 <ul><li><a>instanceof</a></li>
5 <ul><li><a>instanceof</a></li>
7 - </ul><p>0</p>
6 + </ul><p>Предлагаю на рассмотрение такой метод:</p>
8 - <p>Предлагаю на рассмотрение такой метод:</p>
 
9 <p>const arr = [1,2,3,4,5]; const arrEmpty = []; const text = 'Text here'; const object = { name: 'Max', age: 30 }; const number = 5; console.log(typeof arr === 'object' &amp;&amp; arr !== null &amp;&amp; arr.length &gt;= 0) // =&gt; true console.log(typeof arrEmpty === 'object' &amp;&amp; arrEmpty !== null &amp;&amp; arrEmpty.length &gt;= 0) // =&gt; true console.log(typeof text === 'object' &amp;&amp; text !== null &amp;&amp; text.length &gt;= 0) // =&gt; false console.log(typeof object === 'object' &amp;&amp; object !== null &amp;&amp; object.length &gt;= 0) // =&gt; false console.log(typeof number === 'object' &amp;&amp; number !== null &amp;&amp; number.length &gt;= 0) // =&gt; false</p>
7 <p>const arr = [1,2,3,4,5]; const arrEmpty = []; const text = 'Text here'; const object = { name: 'Max', age: 30 }; const number = 5; console.log(typeof arr === 'object' &amp;&amp; arr !== null &amp;&amp; arr.length &gt;= 0) // =&gt; true console.log(typeof arrEmpty === 'object' &amp;&amp; arrEmpty !== null &amp;&amp; arrEmpty.length &gt;= 0) // =&gt; true console.log(typeof text === 'object' &amp;&amp; text !== null &amp;&amp; text.length &gt;= 0) // =&gt; false console.log(typeof object === 'object' &amp;&amp; object !== null &amp;&amp; object.length &gt;= 0) // =&gt; false console.log(typeof number === 'object' &amp;&amp; number !== null &amp;&amp; number.length &gt;= 0) // =&gt; false</p>