screen_rotation
Copied to Clipboard
<html> <head> <script type="importmap"> { "imports": { "vue": "https://unpkg.com/vue@3/dist/vue.esm-browser.js" } } </script> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-F3w7mX95PdgyTmZZMECAngseQB83DfGTowi0iMjiWaeVhAn4FJkqJByhZMI3AhiU" crossorigin="anonymous"> <body> <div id="app" class="container"> <h2>Array Filter method using Vue js</h2> <p>All the result [] values that are odd numbers should be returned as an array.:</p> <P>Numbers : {{numbers}}</P> <button @click='myFunction' class='btn btn-primary'>Return odd number</button> <p></p> <p v-html='result'></p> </div> <script type="module"> import { createApp } from 'vue' createApp({ data() { return{ numbers : ['32','11','37','60','41','72'], result : '' } }, methods:{ myFunction(){ this.result = this.numbers.filter(this.checkOddNumber); }, checkOddNumber(number){ return number % 2 == 1; } } }).mount('#app') </script> </body> </head> </html>