screen_rotation
Copied to Clipboard
<html> <head> <script type="importmap"> { "imports": { "vue": "https://unpkg.com/vue@3/dist/vue.esm-browser.js" } } </script> <body> <div id="app"> <h2>Vue js Array length Method function</h2> <p>Get lenght of array, number of element present in exisiting array</p> <p>Array : {{array}}</p> <button @click="myFunction">Get length</button> <p></p> <p>Length: {{result}}</p> </div> <script type="module"> import { createApp } from 'vue' createApp({ data() { return{ array:['India','England','America','Australia','China','Russia'], result : '' } }, methods:{ myFunction(){ this.result = this.array.length; }, } }).mount('#app') </script> </body> </head> </html>