screen_rotation
Copied to Clipboard
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Find First Even Number Index</title> <script type="importmap"> { "imports": { "vue": "https://unpkg.com/vue@3/dist/vue.esm-browser.js" } } </script> </head> <body> <div id="app"> <h2>Find First Even Number Index using Vue.js</h2> <p>Numbers: {{ numbers }}</p> <button @click="findFirstEvenIndex">Find First Even Number Index</button> <p v-if="firstEvenIndex !== ''">Index: {{ firstEvenIndex }}</p> </div> <script type="module"> import { createApp } from 'vue'; createApp({ data() { return { numbers: [33, 15, 38, 69, 45, 70], firstEvenIndex: '' }; }, methods: { findFirstEvenIndex() { this.firstEvenIndex = this.numbers.findIndex(number => number % 2 === 0); } } }).mount('#app'); </script> </body> </html>