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 Get last element in an array</h2> <button @click="myFunction">Get </button> <p>{{river}}<p> <p>Return last Element: {{results}}</p> </div> <script type="module"> import { createApp } from 'vue' createApp({ data() { return{ river:['Amazon','Mekong','Amur','Volgo','Rhine','Danube'], } }, methods:{ myFunction(){ this.results = this.river.pop(); }, } }).mount('#app') </script> </body> </head> </html>