当前位置:网站首页>Array's own method
Array's own method
2022-06-23 16:05:00 【Irascible plums are rotten Online】
Array.prototype.at()
at() Method receives an integer value and returns the entry of the index , Allow positive and negative numbers .
Negative integers count down from the last item in the array
// A function , Used to return the last item of a given array
function returnLast(arr) {
return arr.at(-1);
}
const a=[{
name:'1'},{
name:'2'},{
name:'3'}]
a.at(0) // {name: '1'}
a.at(-1) // {name: '3'}
this.returnLast(a) // {name: '3'}
Array.prototype.concat()
concat() Method is used to merge two or more arrays . This method does not change the existing array , Instead, it returns a new array
const array1 = ['a', 'b', 'c'];
const array2 = ['a', 'e', 'f'];
const array3 = [1,2,3];
//array1.concat(array2); Array ["a", "b", "c", "a", "e", "f"]
//array1.concat(array2,array3); Array ["a", "b", "c", "a", "e", "f", 1, 2, 3]
at: ƒ at()
concat: ƒ concat()
constructor: ƒ Array()
copyWithin: ƒ copyWithin()
entries: ƒ entries()
every: ƒ every()
fill: ƒ fill()
filter: ƒ filter()
find: ƒ find()
findIndex: ƒ findIndex()
findLast: ƒ findLast()
findLastIndex: ƒ findLastIndex()
flat: ƒ flat()
flatMap: ƒ flatMap()
forEach: ƒ forEach()
includes: ƒ includes()
indexOf: ƒ indexOf()
join: ƒ join()
keys: ƒ keys()
lastIndexOf: ƒ lastIndexOf()
length: 0
map: ƒ map()
pop: ƒ pop()
push: ƒ push()
reduce: ƒ reduce()
reduceRight: ƒ reduceRight()
reverse: ƒ reverse()
shift: ƒ shift()
slice: ƒ slice()
some: ƒ some()
sort: ƒ sort()
splice: ƒ splice()
toLocaleString: ƒ toLocaleString()
toString: ƒ toString()
unshift: ƒ unshift()
values: ƒ values()
Symbol(Symbol.iterator): ƒ values()
边栏推荐
- 图片读取:Image.open(ImgPath)
- TCP protocol notes
- Summarize the experience of purchasing Alibaba cloud servers
- Six programming insights in these five years!
- MySQL transactions and locks
- [tcapulusdb knowledge base] Introduction to tmonitor stand-alone installation guidelines (II)
- TCP协议笔记
- 139. 單詞拆分
- stylegan2:analyzing and improving the image quality of stylegan
- 《ThreadLocal》
猜你喜欢
随机推荐
现在我要买股票,怎么开户?手机开户安全么?
Example of if directly judging data type in JS
Explore the "store" on the cloud. The cloud store is newly upgraded!
Avoid these six difficulties and successfully implement MES system
glibc nptl库pthread_mutex_lock和pthread_mutex_unlock浅析
C. Product 1 Modulo N-Codeforces Round #716 (Div. 2)
139. 單詞拆分
get_edges
If no code is moved, the project access speed drops significantly the next day. Case analysis
Introduction to asynccontext
Six programming insights in these five years!
PageHelper faces the paging problem of complex service data processing
Memory consistency and cache consistency
Servlet 3.0的AsyncListener接口
VIM backup history command
[openharmony] USB gadget configuration HDC function cfg file interpretation
pytorch:模型的保存与导出
请问期货开户去哪个平台好?网上期货开户安全吗?
stylegan1: a style-based henerator architecture for gemerative adversarial networks
freemark 使用ftl文件 生成word









