1: The split function splits the string by a specific character and saves the split result to the string array.
Function splitusersinformation (users ){VaRUsersarray = users. Split (';');ReturnUsersarray;}
2: The substr function is used to cut
In JavaScript, it is usually difficult to determine whether a variable is an array, because
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->VaRA=[];Alert (TypeofA=== 'Object');//True
Three methods for deleting arrays by using explain script1. Use shift () methodShift: Delete the first entry of the original array and return the value of the deleted element. If the array is empty, undefined is returned.VaR chaomao = [1, 2, 3, 4, 5]
The array type is one of the most commonly used types in ECMAScript, and the arrays in ECMAScript are quite different from those in most other languages. Each item of the ECMAScript array can hold any type of data. Most of the methods of array types
This series is mainly for the basic knowledge of JS related to make a summary, but also most novice easy to confuse the place.(1) SliceSlice () is the substring () version of the corresponding string, which intercepts some elements of the array and
String object:How to create an object:One: var str=new string ("string content");Two: var str= "string content";Common methods for string objects:Anchor () Production anchor pointBlink () Adding blink tags to elementsCharAt () returns the character
We first define a JSON array object as follows:var persons = [ "Tina" , age:14}, "Timo", Age:15}, "Lily", Age:16 }, "Lucy", Age:16}]I. Get the corresponding object based on the object property value// 1. Get name equals Lily's Object
Summary of common methods for arrays in JavaScript 1, Join () method: The Array.join () method converts the elements in the array to strings, and returns the last generated string. Optionally, you can specify an optional string to separate the
1: The split function splits the string by a specific character and saves the split result to the string array.Copy codeThe Code is as follows:Function SplitUsersInformation (users ){Var usersArray = users. split (';');Return usersArray;}2: The
definition of an array :an array in JavaScript is a special object that represents an index of an offset that is a property of that object, which is likely to be an integer. However, these numeric indexes are internally converted to string types
Reference Address: http://www.398588.com/Article/T8/96.aspxIt is well known that everyone should know the use of Delete, to delete the object or delete the array, etc., if the object is deleted outside the divisor may be deleted, "clean" is what it
An array is a linearly allocated memory that computes offsets and accesses the elements in an integer. Most languages require an array of elements to be of the same type, but a JavaScript array can contain any type.var NULL true true }, Infinity, ['
Javascript is a non-type language, so an array element can have any data type. different elements of the same array can have different types, array Element settings can contain other arrays, so that you can create a complex array.
At this point,
Js usage Summary
1. Periodically execute functions
The setTimeout () method is used to call a function or computing expression after a specified number of milliseconds.Example:
or:
2. How to determine whether an object exists in js
Typeof
1. Normal Value of json data: json [I]. fieldName
2. json data fields contain spaces: eval ('json ['+ I +'] ["'+ field +'"] ')
3. json Data assignment: eval ('json ['+ I +'] ["'+ field +'"] = '+ jsonFilter. length );
4. Add fields to json data:
Copy codeThe Code is as follows:Var obj = {length: 0, splice: function (){}}Console. log (obj) Guess what is printed on it?That's right. The output looks like an empty array...In FIREBUG, if an object has both the length attribute and the splice
/* another use of the splice () method is to add an array element splice (X1,Y1,Z1) X1: The starting index (which is where you want to start adding elements), and X2: The number of elements that need to be deleted (this parameter is set to 0
1. slice Method (Array)Returns an array.ArrayObj. slice (start, [end])ParametersArrayObjRequired. An Array object.StartRequired. The starting element of the part specified in arrayObj is the subscript calculated from scratch.EndOptional. The ending
untitled document [Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]You can perform detection on your own, instead of adding events to each checkbox. The delete function is not implemented.
ArrayObj. splice (start, deleteCount, [item1 [, item2 [,... [, itemN])ParametersArrayObjRequired. An Array object.StartRequired. Specifies the start position of the element to be removed from the array. This position is calculated from
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.