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 string slice() Method when given argument is negative</h2> <button @click="myFunction">click me</button> <p>{{demoArray}}</p> <p>New Array: {{results}}</p> </div> <script type="module"> import { createApp } from 'vue' createApp({ data() { return{ demoArray:['a','b','c','d','e','f','g','h'], results:'' } }, methods:{ myFunction(){ this.results = this.demoArray.slice(-7,-4); }, } }).mount('#app') </script> </body> </head> </html>