当前位置:网站首页>数组
数组
2022-06-12 23:37:00 【InfoQ】
数组常用方法
1.
push()语法
var arr = ['hello', 'world', '你好', '世界'];
var res = arr.push('新来的', '新来的2', [10, 20]);
console.log(res);
console.log(arr);
2. pop()语法
var arr = ['hello', 'world', '你好', '世界', '新来的', '新来的2'];
var res = arr.pop();
console.log(res);
console.log(arr);
3. unshift()
var arr = ['hello', 'world', '你好', '世界', '新来的', '新来的2'];
var res = arr.unshift('A');
console.log(res);
console.log(arr);
4.
shift()
var arr = ['hello', 'world', '你好', '世界', '新来的', '新来的2'];
var res = arr.shift('hello');
console.log(res);
console.log(arr);
5. reverse()
6. sort()
var arr = [1, 11, 33, 26, 51, 19, 32, 27, 15, 100]
var res = arr.sort()
console.log(arr)
边栏推荐
- [literature translation - Part] revealing the structure of clinical EEG signals by self supervised learning (SSL and RP principles / data / preprocessing)
- Industry reshuffle, a large number of programmers are going to lose their jobs? How can we break the current workplace dilemma
- InfoQ 极客传媒 15 周年庆征文|简述构建微服务架构的四大挑战
- 〖Kubernetes指南④〗Pod快速入门
- TCP与UDP
- Lua date time
- 细数攻防演练中十大关键防守点
- How to get Matplotlib figure size
- Leetcode1601: the maximum number of building change requests that can be reached (difficult)
- DETR(Detection with Transformers) 学习笔记
猜你喜欢

How to get Matplotlib figure size
![[literature translation - Part] revealing the structure of clinical EEG signals by self supervised learning (SSL and RP principles / data / preprocessing)](/img/6f/890bfa8c2928712fecc6560c72bad9.jpg)
[literature translation - Part] revealing the structure of clinical EEG signals by self supervised learning (SSL and RP principles / data / preprocessing)
C language: how to give an alias to a global variable?
![[opencv learning] perspective transformation matrix](/img/6e/7a53b257f6baafe8a3ae21cd0fe340.jpg)
[opencv learning] perspective transformation matrix
![Software development tools [3] theoretical basis of software development tools](/img/24/6a3c593931523ceb17e323bc0367b4.jpg)
Software development tools [3] theoretical basis of software development tools

ASP. Net core Middleware

Colab教程(超级详细版)及Colab Pro/Colab Pro+使用评测

MySQL row to column, column to row, multiple columns to one row, one row to multiple columns

测试平台系列(97) 完善执行case部分

RT thread quick start - experience RT thread
随机推荐
How to package a colorpicker component for color selection?
[issue 30] shopee golang development experience
Analysis report on investment and development trend of gap base of Chinese traditional medicine 2022 ~ 2028
Save state when viewpager is used with fragment fragmentpageradapter
模型过拟合-解决方案(二):Dropout
【建议收藏】通俗易懂图解网络知识-第一篇
设计消息队列存储消息数据的 MySQL 表格
Restrictions on MySQL function creation
TCP与UDP
Alien skin exposure X7 color filter plug-in, raw post-processing tool
妙才周刊 - 5
QT actual combat case (38) -- using qpprocess class to realize the function of starting process
Dix points de défense clés dans les exercices d'attaque et de défense détaillés
The "fourteenth five year plan" development plan and panoramic strategic analysis report of China's information and innovation industry 2022 ~ 2028
Message queue directory
Summary of the lowest level error types in PHP
Go时间格式化 赋值
ASP. Net core Middleware
Teach you how to grab ZigBee packets through cc2531 and parse encrypted ZigBee packets
Colab tutorial (super detailed version) and colab pro/colab pro+ usage evaluation