JavaScript Reference/Javascript Methods/shift

Материал из Web эксперт
Перейти к: навигация, поиск

"shift()" Example

   <source lang="javascript">
   

<html> <body> <button onclick="var myA = new Array(10,11,12); myA.shift(); alert(myA);">SHIFT</button> </body> </html>


     </source>
   
  


"shift()" is applied to

   <source lang="javascript">

+----------------+--------------------------------------------------------------+ | Applied_To |Array | +----------------+--------------------------------------------------------------+

     </source>
   
  


"shift()" Syntax, Parameters and Note

   <source lang="javascript">

Note: Removes the first element in an array. Returns the element being removed.

Syntax:

arrayName.shift()


     </source>