Vue.Js Array Pop

Array Pop function is used to remove the last element from array and it returns that element. Here in this tutorial, we are going to explain how to use native JavaScript Array Pop function remove an element from Array. You can also use our online editor to edit and run the code online.

Vue.Js Array Pop Method Example

You can use JavaScript Array Pop method in Vue.Js simply as below-


<div id="app">
	<p>item 1 = {{ item1 }}</p>	
	<p>Result = {{result}}</p>
	<button @click="myFunction()">Click Me</button>
 new Vue({
el: '#app',
  data: { 
	  item1:[12, 10, 9, 5, 6, 4],
    myFunction: function () {		
		this.result = this.item1.pop();	


Try it »

Output of above example-

Vue.js Array Pop


Add Comment

📖 Read More