博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
数组push()方法以及JavaScript中的示例
阅读量:2532 次
发布时间:2019-05-11

本文共 859 字,大约阅读时间需要 2 分钟。

JavaScript push()方法 (JavaScript push() method)

push() method is used adds/inserts an element at the end of an array, it returns nothing but changes the length of the array.

push()方法用于在数组末尾添加/插入元素,它只返回改变数组的长度,什么也不返回。

Syntax:

句法:

array_name.push(element1, element2, ...);

It accepts one or more than one elements and inserts to the end of the array and changed the length of an array.

它接受一个或多个元素,然后插入到数组的末尾并更改数组的长度。

Examples:

例子:

Input:    var countries = ["INDIA", "USA"];    Function call:    countries.push("UK");    countries.push("CANADA", "RUSSIA");        Output:    "INDIA", "USA", "UK", "CANADA", "RUSSIA"

JavaScript Code to demonstrate example of Array.push() method

JavaScript代码演示Array.push()方法的示例

JavaScipt Example	

Output

输出量

countries: INDIA,USAlength is: 2countries: INDIA,USA,UKlength is: 3countries: INDIA,USA,UK,CANADA,RUSSIAlength is: 5

翻译自:

转载地址:http://ayazd.baihongyu.com/

你可能感兴趣的文章
ARPA
查看>>
JSP开发模式
查看>>
我的Android进阶之旅------>Android嵌入图像InsetDrawable的使用方法
查看>>
Detours信息泄漏漏洞
查看>>
win32使用拖放文件
查看>>
Android 动态显示和隐藏软键盘
查看>>
raid5什么意思?怎样做raid5?raid5 几块硬盘?
查看>>
【转】how can i build fast
查看>>
null?对象?异常?到底应该如何返回错误信息
查看>>
django登录验证码操作
查看>>
(简单)华为Nova青春 WAS-AL00的USB调试模式在哪里开启的流程
查看>>
图论知识,博客
查看>>
[原创]一篇无关技术的小日记(仅作暂存)
查看>>
20145303刘俊谦 Exp7 网络欺诈技术防范
查看>>
原生和jQuery的ajax用法
查看>>
iOS开发播放文本
查看>>
20145202马超《java》实验5
查看>>
JQuery 事件
查看>>
main(argc,argv[])
查看>>
在线教育工具—白板系统的迭代1——bug监控排查
查看>>