aboutsummaryrefslogtreecommitdiff
path: root/files/ar/web/javascript/reference/global_objects/array/pop/index.html
blob: 247f45fc14dbb2ccad636b9fb133df9fd2c65d5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
---
title: Array.prototype.pop()
slug: Web/JavaScript/Reference/Global_Objects/Array/pop
translation_of: Web/JavaScript/Reference/Global_Objects/Array/pop
---
<div dir="rtl">{{JSRef}}<br>
   دالة <code><strong>pop() </strong></code>هي دالة تقوم بمسح أخر عنصر من المصفوفة وإرجاعه</div>

<div dir="rtl"> </div>

<h2 dir="rtl" id="Syntax">Syntax</h2>

<pre class="syntaxbox" dir="rtl"><var>arr</var>.pop()</pre>

<h3 dir="rtl" id="قيمة_الإرجاع">قيمة الإرجاع</h3>

<p dir="rtl">تعيد أخر عنصر من المصفوفة و تعيد {{jsxref("undefined")}}  في حال  كانت المصفوفة فارغة</p>

<h2 dir="rtl" id="وصف">وصف</h2>

<p dir="rtl"> دالة POP هي دالة تقوم بمسح أخر عنصر من المصفوفة وإرجاع تلك القيمة إلى الطالب </p>

<p dir="rtl"><code>pop</code> is intentionally generic; this method can be {{jsxref("Function.call", "called", "", 1)}} or {{jsxref("Function.apply", "applied", "", 1)}} to objects resembling arrays. Objects which do not contain a <code>length</code> property reflecting the last in a series of consecutive, zero-based numerical properties may not behave in any meaningful manner.</p>

<p dir="rtl"> في حالة استدعائك لدالة POP على مصفوفة فارغة فسيتم إرجاع  {{jsxref("undefined")}} </p>

<h2 dir="rtl" id="أمثلة">أمثلة</h2>

<h3 dir="rtl" id="إزالة_العنصر_الأخير_من_المصفوفة">إزالة العنصر الأخير من المصفوفة</h3>

<p dir="rtl">التعليمة البرمجية التالية : تقوم بإنشاء مصفوفة(<code>myFish</code> )   تحتوي على أربعة  عناصر ثم تقوم بمسح أخر عنصر   </p>

<pre class="brush: js" dir="rtl">var myFish = ['angel', 'clown', 'mandarin', 'sturgeon'];

console.log(myFish); // ['angel', 'clown', 'mandarin', 'sturgeon']

var popped = myFish.pop();

console.log(myFish); // ['angel', 'clown', 'mandarin' ]

console.log(popped); // 'sturgeon'</pre>

<h2 dir="rtl" id="مواصفات">مواصفات</h2>

<table class="standard-table" dir="rtl">
 <tbody>
  <tr>
   <th scope="col">مواصفات</th>
   <th scope="col">الحالة</th>
   <th scope="col">تعليق</th>
  </tr>
  <tr>
   <td>{{SpecName('ES3')}}</td>
   <td>{{Spec2('ES3')}}</td>
   <td>Initial definition. Implemented in JavaScript 1.2.</td>
  </tr>
  <tr>
   <td>{{SpecName('ES5.1', '#sec-15.4.4.6', 'Array.prototype.pop')}}</td>
   <td>{{Spec2('ES5.1')}}</td>
   <td> </td>
  </tr>
  <tr>
   <td>{{SpecName('ES6', '#sec-array.prototype.pop', 'Array.prototype.pop')}}</td>
   <td>{{Spec2('ES6')}}</td>
   <td> </td>
  </tr>
  <tr>
   <td>{{SpecName('ESDraft', '#sec-array.prototype.pop', 'Array.prototype.pop')}}</td>
   <td>{{Spec2('ESDraft')}}</td>
   <td> </td>
  </tr>
 </tbody>
</table>

<h2 dir="rtl" id="Browser_compatibility">Browser compatibility</h2>

<div dir="rtl">{{CompatibilityTable}}</div>

<div dir="rtl" id="compat-desktop">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Chrome</th>
   <th>Firefox (Gecko)</th>
   <th>Internet Explorer</th>
   <th>Opera</th>
   <th>Safari</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatChrome("1.0")}}</td>
   <td>{{CompatGeckoDesktop("1.7")}}</td>
   <td>{{CompatIE("5.5")}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
  </tr>
 </tbody>
</table>
</div>

<div dir="rtl" id="compat-mobile">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Android</th>
   <th>Chrome for Android</th>
   <th>Firefox Mobile (Gecko)</th>
   <th>IE Mobile</th>
   <th>Opera Mobile</th>
   <th>Safari Mobile</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
  </tr>
 </tbody>
</table>
</div>

<h2 dir="rtl" id="See_also">See also</h2>

<ul>
 <li dir="rtl">{{jsxref("Array.prototype.push()")}}</li>
 <li dir="rtl">{{jsxref("Array.prototype.shift()")}}</li>
 <li dir="rtl">{{jsxref("Array.prototype.unshift()")}}</li>
 <li dir="rtl">{{jsxref("Array.prototype.splice()")}}</li>
</ul>