C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
JavaScript Array shift() methodThe JavaScript array shift() method removes the first element of the given array and returns that element. This method changes the length of the original array. SyntaxThe shift() method is represented by the following syntax: array. shift() ReturnThe first element of an array. JavaScript Array shift() method exampleLet's see an example to remove and return the first element of an array. Example<script> var arr=["AngularJS","Node.js","JQuery"]; var result=arr.shift(); document.writeln(result); </script> Output: AngularJS
Next TopicJavaScript Array
|