Vue.js Get Array Length

Vue.js Get Array Length– JavaScript .length property can be used to get the length of array or object.

Vue.js Get Array Length | Object length| Example

You can get length of any array or object simply as below-


<!DOCTYPE html>
 <script src=""></script>
<ul id="exampleApp">
  <li v-if="items.length">Object Length = {{items.length}}</li>
  <li v-for="item in items">
    {{ item.fruit }}
var exampleApp = new Vue({
  el: '#exampleApp',
  data: {
    items: [
      { fruit: 'Mango' },
      { fruit: 'Apple' },
      { fruit: 'Banana' }

Try it »

Ouput of above example-

Vue.js Get Array Length Example


Add Comment

📖 Read More