Vue.js Array Shift
This method removes an element from the beginning of array.
Vue.js Array Shift Method Example
Here is an example of JavaScript Array Shift method in Vue.JS-
Example:
<div id="app"> <p>item 1 = {{ item1 }}</p> <button @click="myFunction()">Click Me</button> </div> <script> new Vue({ el: '#app', data: { item1:[12, 10, 9, 5, 6, 4] }, methods:{ myFunction: function () { this.item1.shift(); } } }); </script> |
Output of above example-
Advertisements