File tree Expand file tree Collapse file tree
05-data-types/05-array-methods Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -68,11 +68,7 @@ if (cond) {
6868
6969## عبارت "else"
7070
71- <<<<<<< HEAD
72- دستور ` if ` ممکن است یک بلوک اختیاری "else" هم شامل شود. این بلوک زمانی که شرط falsy باشد اجرا میشود.
73- =======
74- The ` if ` statement may contain an optional ` else ` block. It executes when the condition is falsy.
75- >>>>>>> ea7738bb7c3616bb51ff14ae3db2a2747d7888ff
71+ دستور ` if ` ممکن است یک بلوک اختیاری ` else ` هم شامل شود. این بلوک زمانی که شرط falsy باشد اجرا میشود.
7672
7773برای مثال:
7874``` js run
Original file line number Diff line number Diff line change @@ -255,11 +255,7 @@ alert( arr.includes(1) ); // true
255255
256256توجه داشته باشید که متدها از مقایسه ` === ` استفاده میکنند. پس اگر ما به دنبال ` false ` باشیم، متد دقیقا ` false ` را پیدا میکند و نه صفر را.
257257
258- <<<<<<< HEAD
259258اگر ما بخواهیم بررسی کنیم که ` item ` درون آرایه وجود دارد یا نه و به دنبال ایندکس دقیق نیستیم، پس ` arr.includes ` ترجیح داده میشود.
260- =======
261- If we want to check if ` item ` exists in the array, and don't need the index, then ` arr.includes ` is preferred.
262- >>>>>>> ea7738bb7c3616bb51ff14ae3db2a2747d7888ff
263259
264260متد [ arr.lastIndexOf] ( mdn:js/Array/lastIndexOf ) مانند ` indexOf ` است اما از راست به چپ جستجو میکند.
265261
@@ -341,16 +337,9 @@ alert(users.findIndex(user => user.name == 'John')); // 0
341337alert(users.findLastIndex(user => user.name == 'John')); // 3
342338` ` `
343339
344- <<<<<< < HEAD
345-
346340### متد filter
347341
348342متد ` find` برای یک (اولین) المان که باعث شود تابع ` true` برگرداند، جستجو میکند.
349- ====== =
350- ### filter
351-
352- The ` find` method looks for a single (first) element that makes the function return `true`.
353- >>>>>>> ea7738bb7c3616bb51ff14ae3db2a2747d7888ff
354343
355344اگر ممکن باشد تعداد بیشتری موجود باشند، میتوانیم از [arr .filter (fn)](mdn: js/ Array / filter) استفاده کنیم.
356345
You can’t perform that action at this time.
0 commit comments