/* Array */
Array. Reverse () // sorts the array in reverse order and changes it to a new array.
Array. Sort () // sorts the array by characters and changes it to a new array.
S = array. Push ("str1", "str2") // Add an array from the back. S is the
96 // Start with an empty Selector
97 selector:"",
98
99// The current version of jquery being used
100 jquery:"1.3.2",
101
102// The number of elements contained in the matched element set
103 size:Function(){
104Return This. Length;
ArticleDirectory
Array object Method
Attribute of an array object
An array is a linear memory allocated. It uses Integers to calculate the offset and access the elements. Arrays are fast data structures, but unfortunately
The module loading system is part of the core modules of our framework and is fully integrated with domready. Of course, the core module also provides other common methods, such as several groups, type determination, simple event binding... the
This article introduces a new cross-browser solution for adding onerror events to jsonp. Due to IE6 ~ 8. The script tag of Opera does not support onerror events. Therefore, general class libraries (including jquery and other libraries I see) nor can
Mass framework uses many methods to generate an approximate method together, greatly reducingCodeTo improve maintainability.
For example, append, prepend, before, and after methods, in jquery2.0, they look like this:
Append: function () {return
I. array. Slice (START, end) method:
Slice () is used to take part of an array and use it to copy the array. If the end parameter is omitted, the split array contains all elements starting from start to the end of the array.
Use it to copy the
Slice () method of the forgotten javascript
The slice Method of the javascript array object separates a sub-array from the array, which is similar to the substring method of the string object. Today, we will discuss in detail this less commonly used
The Forgotten javascript slice () method, javascriptslice
The slice () method returns the selected element from an existing array.
Okay, I admit I forgot it!
I will review it this time.
Syntax
ArrayObject. slice (start, end)Array. slice (START,
Several common methods of javascript array, javascript Array
1. join ()
The Array. join method converts all elements in the Array into strings and concatenates them. The final generated string is returned.
Example:
Var a = [1, 2, 3]
A. join (); => "1
Class array objects in JavaScript, javascript Array
A long time ago, I knew that I could convert arguments to an array: []. slice. call (arguments) becauseArguments is a class array object, so this can be used. But I still don't know what it is
Common javascript Array Methods
(1) Basic Array Method
1. join ()
The Array. join () method converts all elements in the Array into strings and concatenates them to return the final string generated. You can specify the Separator by yourself. If not
Summary of array methods in Javascript
Array. prototype defines many methods to operate arrays. The following describes some methods in ECMAScript3.
1. Array. join () method
This method converts all elements in the array into strings and connects
Common JavaScript objects and javascript objectsCommon objects, attributes, and usage:(1). Array objectArray objects are used to store multiple values in a single variable.Syntax for creating an Array object:New Array ();New Array (size );New Array (
Fortunately, we can use the array slice Method to convert the arguments object into a real array:
Var args = Array. prototype. slice. call (arguments );
For the slice method, section 15.4.4.10 Array. prototype. slice (start, end) in ECMAScript 262
1. prototype:
(1). Using prototype can greatly reduce the memory demand for each object, because the object can inherit many attributes.
(2). Objects can inherit these attributes even if they are added to the prototype after the object is
Eq (index) obtains the position of the nth element from 0.
Reduce the set of matched elements to a single element. The position of the element in the set of matched elements starts at 0 and goes to length-1. Return
Array. prototype. push
Push adds an item to the end of the array and updates the length to return the array length.
What if the Object uses push?
Look at the following code. obj works like an array. Length is automatically updated.
Copy codeThe
This object is an extension of the function. The most important thing is the bind method. prototype's help document specifically says: Prototype takes issue with only one aspect of functions: binding. the wrap method is also very important. In the
JS Array learning summary, jsarray Array Summary
The reference types include Object type (so-called Object), Array type (Array discussed in this article), and Function type.
So what is the array? In my opinion, it is used to save data.
I. Declare an
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.