Vue.js Array Find

JavaScript Find method is used to find the value in array based on test(provided as function). Here in this tutorial, we are going to explain how you can use this method in Vuejs. You can also use our online editor to edit and run the code online.

Vue.js Array Find Method Example

You can use find method in vue.js simply as below-


<div id="app">
	<p>item 1 = {{ item1 }}</p>
	<p>Result = {{ item2 }}</p>

	<button @click="myFunction()">Click Me</button>
 new Vue({
el: '#app',
  data: { 
	  item1:['12', '10', '9','5', '6', '4'],
    myFunction: function () {		
		this.item2 = this.item1.find(this.checkNum);
	   if(num > 9){
	    return num;


Try it »

The find function will test the array value based on function checkNum and return the first matching value.

Output of above example-

Vue.js find function example


Add Comment

📖 Read More