Vue.js Array Reverse


This method reverses the order of elements in array. Here in this tutorial, we are going to explain how to use Array reverse in Vuejs. You can also use our online editor to edit and run the code online.


Vue.js Array Reverse Method Example

You can use JavaScript Reverse method simply as below-

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.reverse();	
    }   
   }

});
</script>

Try it »

Output of above example-

Vue.js Array Reverse JavaScript Example

Advertisements

Add Comment

📖 Read More