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 Math.abs() Method </h2> <p>convert a positive number to a negative number in Vue.js</p> <button @click='myFunction'>click me</button> <p>{{posNumber}}</p> <p>Negative Number: {{negNumber}}</p> </div> <script type="module"> import { createApp } from 'vue' createApp({ data() { return{ posNumber:[34,21,63,28], negNumber:[] } }, methods:{ myFunction(){ for(var i=0; i <this.posNumber.length;i++){ this.negNumber.push(-Math.abs(this.posNumber[i])) } } } }).mount('#app') </script> </body> </head> </html>