Join WhatsApp ChannelJoin Now

Vue JS Get Array Length Or Object Length Example

Today, i we will show you vue js get array length or object length example. This article will give you simple example of vue js get array length or object length example. you will learn vue js get array length or object length example. So let’s follow few step to create example of vue js get array length or object length example.

Preview:
vue js get array length or object length example

Example

<!DOCTYPE html>
<html>
<head>
    <title>Vue JS Get Array Length Or Object Length Example</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: 'Wordpress' },
          { category: 'Codeigniter' }
        ]
      }
    })
  
</script>
  
</body>
</html>

Recommended Posts