From 1109132f09d75da9a28b649c7677bb6ce07c40c0 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:41:45 -0500 Subject: initial commit --- .../global_objects/array/unshift/index.html | 94 ++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 files/he/web/javascript/reference/global_objects/array/unshift/index.html (limited to 'files/he/web/javascript/reference/global_objects/array/unshift/index.html') diff --git a/files/he/web/javascript/reference/global_objects/array/unshift/index.html b/files/he/web/javascript/reference/global_objects/array/unshift/index.html new file mode 100644 index 0000000000..9febfb5ad4 --- /dev/null +++ b/files/he/web/javascript/reference/global_objects/array/unshift/index.html @@ -0,0 +1,94 @@ +--- +title: Array.prototype.unshift() +slug: Web/JavaScript/Reference/Global_Objects/Array/unshift +translation_of: Web/JavaScript/Reference/Global_Objects/Array/unshift +--- +
{{JSRef}}
+ +
המתודה ()unshift  מוסיפה אלמנט אחד או יותר לתחילת מערך ומחזירה את גודלו החדש של המערך. 
+ +
{{EmbedInteractiveExample("pages/js/array-unshift.html")}}
+ +

Syntax

+ +
arr.unshift(element1[, ...[, elementN]])
+ +

פרמטרים

+ +
+
elementN
+
אלמנטים להוספה לתחילת המערך.
+
+ +

ערך מוחזר

+ +

את ערך השדה {{jsxref("Array.length", "length")}} החדש של המערך עליו הופעלה המתודה.

+ +

תאור

+ +

המתודה unshift מכניסה את ערכי האלמנטים שקיבלה כפרמטר לתחילת אובייקט המערך. 

+ +

unshift 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 length property reflecting the last in a series of consecutive, zero-based numerical properties may not behave in any meaningful manner.

+ +

Examples

+ +
var arr = [1, 2];
+
+arr.unshift(0); // result of call is 3, the new array length
+// arr is [0, 1, 2]
+
+arr.unshift(-2, -1); // = 5
+// arr is [-2, -1, 0, 1, 2]
+
+arr.unshift([-3]);
+// arr is [[-3], -2, -1, 0, 1, 2]
+
+ +

Specifications

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('ES3')}}{{Spec2('ES3')}}Initial definition. Implemented in JavaScript 1.2.
{{SpecName('ES5.1', '#sec-15.4.4.13', 'Array.prototype.unshift')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-array.prototype.unshift', 'Array.prototype.unshift')}}{{Spec2('ES6')}} 
{{SpecName('ESDraft', '#sec-array.prototype.unshift', 'Array.prototype.unshift')}}{{Spec2('ESDraft')}} 
+ +

Browser compatibility

+ +
+ + +

{{Compat("javascript.builtins.Array.unshift")}}

+
+ +

See also

+ + -- cgit v1.2.3-54-g00ecf