javascript - console.log(["2","3"].push("1")) Why is the result 3
伊谢尔伦
伊谢尔伦 2017-05-19 10:42:23
0
5
761

javascript

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(5)
世界只因有你
push() 方法可向数组的末尾添加一个或多个元素,并返回新的长度。

3 is actually the length of the new array.

左手右手慢动作

Experiment yourself, push execution will return the length of the array

Ty80

What is printed is push的返回值,pushreturning the new length

给我你的怀抱

push() adds one or more elements to the end of the array and returns the new length.

Reference http://www.w3school.com.cn/js...

小葫芦

The

push() method adds one or more elements to the end of the array and returns the new length of the array, so what is printed is the length of the array.

Refer to this document

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!