Common methods of JavaScript strings and arrays

charAt() queries the index according to the subscript, indexOf() queries the index, and lastindexOf() queries the last position

toUpperCase() uppercase, toUpperCase() lowercase, replace("character",'replace') replacement, substring(3,dd.length) parameter one => from the current index, parameter two => get all the lengths back Value, substr(3,2) parameter one => get index, parameter two => number after parameter one index

push('add 1') add at the end

unshift() head ti added

splick(parameter one, parameter two, parameter three) => a splice() method to add/remove items to/from the array, and then return the deleted item. Two: Need. The number of items to delete. If set to 0, the project will not be deleted. Three: optional. The new item added to the array.

Guess you like

Origin blog.csdn.net/qq_42113778/article/details/81866856