Files
2018-10-16 21:32:40 +05:30

342 B
Raw Blame History

title, localeTitle
title localeTitle
Manipulate Arrays With unshift() 使用unshift操作数组

使用unshift操作数组

push()向元素的后面添加元素时, unshift()会将它们添加到前面。你所要做的就是:

var arr = [2, 3, 4, 5]; 
 arr.unshift(1); // Now, the array has 1 in the front