IndexOfReturns the index of the element in the array. If no index exists,-1 is returned. Similar to the indexOf method of string.If other browsers do not implement this method, use the following code for compatibility:Copy codeThe Code is as follows:
comparison of data with other languagessame point: Ordered listdifferent points: Each item of the JS array can hold any type of data, and the size of the array can be dynamically adjustedtwo ways to create arrays1) var colors = new Array ();//Create
First, the common method of array 1:join ();
Converts an array to a string display. No parameters are entered, the default is a comma connection, and the input parameter is connected by a parameter.
var arr=[1,2,3];
Console.log (Arr.join ())
Garbage Collection principle:Identify the variables that are no longer in use, and then release their memory.The most commonly used garbage collection method in JS is tag cleanup , when variables enter the environment, the variables are marked as "
This article introduces the JavaScript array iterative method for everyone to refer to, the specific contents are as follows
Each method receives two parameters: the function to run on each item and (optionally) the scope object to run the function.
The array type is the most commonly used reference type in ECMAScript. The data in ECMAScript is quite different from the arrays in most other languages. Although the data in ECMAScript is an ordered list of data like an array in other languages,
(i) string SDS
1) Sdsnew: Create a SDS containing the given C string
2) Sdsempty: Create an empty SDS that does not contain any content
3) Sdsfree: Release of the given SDS
4) Sdslen: Number of bytes of used space returned to SDS
5) Sdsavail: The
Fifth Chapter reference types Objects are instances of a reference type, which is a data structure that organizes data and functionality together. Describes the properties and methods that a class of objects have. An object is an instance of a
Function
Describe
Abs (number)
Returns the absolute value of a number
Apply (Function[,args[,kwds]])
Invokes the given function, optionally providing a parameter
All (iterable)
Returns
Iterative methods:Every () runs the given function for each item in the array, and returns True if the function returns true for each item. Use this method to determine whether all items in the array meet a condition, similar to the meaning of
Every:Each item in an array runs the given function, and returns TRUE if the function returns true for each item.var number = [1,2,3,4,5,6]; var result = Number.every (function(item,index,array) { return (item > 0 )}) Console.log (result)
Array
Slice [Start,end]
Returns a new array (without affecting the original array) from the item specified in the original array to the beginning of the subscript to the end
Splice ()
There are two ways to create arrays in array creation JavaScript, the first of which is to use the array constructor:varARR1 =NewArray ();//create an empty arrayvarARR2 =NewArray (20);//create an array with 20 itemsvarARR3 =NewArray ("Lily", "Lucy",
Array in the written test will often appear in the face test, JavaScript in the array and other languages of the array is somewhat different, in order to facilitate the study of the array method, the following small series for everyone to organize
think about your work. iOS development for more than a year the blink of an eye is over, but it's not over yet, and it's just that the previous development, though not at the apex, is a successful transformation through my tireless efforts, albeit
Spl_autoload_register register the given function as _ autoload implementation official address: php. netmanualhfunction. spl-autoload-register.php my test defines three files test. phptest1.phptest2. phptest. php? Phpspl_autoload_register (autoLoad1
Cmake: how to compile the platform checkIf you want to write software and run it on different operating systems, you must take care of the special nature of different platforms. There are minor differences in different operating systems. For example,
Array methods have array prototype methods, there are methods inherited from object objects, here we only introduce the array of prototype methods, array prototype method mainly has the following:Join ()Push () and pop ()Shift () and unshift ()Sort (
The 1.some method sequentially detects whether each element in the array conforms to the condition of a given function, returns a Boolean value, does not process an empty array, and does not alter the original array. In execution, there is a
Busy today, see some of the operation of the array, long time wood has been useful, many have forgotten almost, so today spent one hours to write some demo, ready to back up the use of a convenient later ~ ~ ~Here are some of the work, often used in
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.