Join WhatsApp ChannelJoin Now

Vue JS Get Array And Object Length

Hello Dev,

Today, i we will show you Vue JS Get Array And Object Length. This article will give you simple example of Vue JS Get Array And Object Length. you will learn Vue JS Get Array And Object Length.

If you don’t know how to get array and object length in vue js. i will give simple example for vue js get array and object length. If you have worked on Javascript and Jquery then you know you can get array length by variable. length so same way you can get array length or object length in vue js application.

So let’s follow few step to create example of Vue JS Get Array And Object Length.

Example:-

<!DOCTYPE html>
<html>
<head>
    <title>Vue JS Get Array Length Or Object Length Example - ItSolutionStuff.com</title>
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
</head>
<body>
   
<div id="app">
   
  <ul id="exampleApp">
    <li v-if="myArray.length">Object Length = {{ myArray.length }}</li>
    <li v-for="value in myArray">
      {{ value.category }}
    </li>
  </ul>
  
</div>
  
<script type="text/javascript">
  
    var app = new Vue({
      el: '#app',
      data: {
        myArray: [
          { category: 'Laravel' },
          { category: 'PHP' },
          { category: 'Codeigniter' }
        ]
      }
    })
  
</script>
  
</body>
</html>

Output:- Object Length = 3
Laravel
PHP
Codeigniter

Recommended Posts