数组pop()删除数组中的最后一个元素,并且返回删除的元素的值shift()删除数组的第一个元素,并且返回是删除的元素的值indexOf()返回在数组中可以找到一个给定元素的第一个索引,如果不存在,则返回-1lastIndexOf()返回指定元素(也即有效的 JavaScript 值或变量)在数组中的最后一个的索引,如果不存在则返回 -1,从数组的后面向前查找unshift()将一个元素或者多个元素添加到数组的开头,并且返回数组的新长度slice()返回一个从开始到结束(不包括结束)选择的数组的一部分浅拷贝到一个新数组对象splice():很强大的数组方法,它有很多种用法,可以实现删除,插入和替换,删除:可以删除任意数量的项,只需指定 2 个参数:要删除的第一项的位置和要删除的项数,例如, splice(0,2)会删除数组中的前两项,插入:可以向指定位置插入任意数量的项,只需提供 3 个参数:起始位置, 0(要删除的项数)和要插入的项,例如,splice(2,0,4,6)会从当前数组的位置 2 开始插入4和6,替换:可以向指定位置插入任意数量的项,且同时删除任意数量的项,只需指定 3 个参数:起始位置,要删除的项数和要插入的任意数量的项,插入的项数不必与删除的项数相等,例如,splice (2,1,4,6)会删除当前数组位置 2 的项,然后再从位置 2 开始插入4和6,splice()方法始终都会返回一个数组,该数组中包含从原始数组中删除的项,如果没有删除任何项,则返回一个空数组8.concat()将参数添加到原数组中,返回新数组,元素组值不改变9.reverse()颠倒原来的数组,返回颠倒之后的数组10.join()方法将一个数组(或一个类数组对象)的所有元素根据传入的参数连接成一个字符串,并返回这个字符串,11.map():指"映射",对数组中的每一项运行给定函数,返回每次函数调用的结果组成的数组,字符串str="abbcalgldkjgldgehlgjldf"; IndexOf (), returns the specified character position of the first occurrence, STR., indexOf (' a ')//the result is 0 lastIndexOf (), returns the position of the specified string was last seen, STR. The lastIndexOf (' f ')//as a result of 22 the substring (), extraction between two specified index number of characters in a string (two index cannot be negative) STR. The substring (0, 5)//result is abbcaslice (), extraction between two specified index number of characters in a string (index can be negative, is the penultimate) STR. Slice (0, 5)//as a result, abbcalgldkjgldgehlcharAt (), the character at the specified index of the return to STR. The charAt (1)//result is bconcat (), connecting two or more strings, return the connection after a new string, var str2="1"; STR. Concat (str2)//result is abbcalgldkjgldgehlgjldf1split (), put the string segmentation for STR string array. The split ()//as a result, [" abbcalgldkjgldgehlgjldf "] the toString (), returns a string object, such as the number into a string object, the trim (), remove the string first Spaces, often in the input and the textarea value judgment used, toLowerCase () to convert a string to lowercase, toUpperCase () to convert a string to uppercase, match (), to find one or more child or a regular expression match, the replace (), replace or of a specified substring and regular expression matching substring, the search () and retrieve the value of the specified substring or matches the regular expression, the return value is the number,
CodePudding user response:
The building Lord why not organize into a blog, for your reference for everybody to learn
It looks too laborious
CodePudding user response:
Was our teacher to let me finish my blog, the mobile phone can't write blogs, can't, had to write posts