javascript shift () Removes the first element of the array

javascript shift () can be first removed from the element in the array wherein the first and returns the value of the element. (If the array is empty, then the shift () method will do nothing, and returns the undefined value.)

<! DOCTYPE HTML> 
<HTML> 
<head> 
    <title> Runde </ title> 
    <Meta HTTP-equiv = "the Content-the Type" Content = "text / HTML; charset = UTF-. 8"> 
    <Script type = "text / JavaScript "> 
        var new new ARR = the Array (. 4) 
        ARR [0] =" Hefei " 
        ARR [. 1] =" Shanghai " 
        ARR [2] =" Canton " 
        ARR [. 3] =" Tianjin " 
        document.write (" original there are an array of elements: "+ arr) 
        document.write (" <br /> ") 
        document.write (" Remove the first item in the array is: "+ arr.shift ()) 
        document.write (" <br /> ") 
        document.write (" array elements after deletion: "+ ARR) 
    </ Script>
</head>
<body>
</body>
</html>

  

 

Guess you like

Origin www.cnblogs.com/rjbc/p/11666231.html