Complete the code to define a computed property in Vue.
<script setup> import { computed, ref } from 'vue' const count = ref(0) const doubled = computed(() => count.value [1] 2) </script>
The computed property doubles the count by multiplying it by 2 using the * operator.
Complete the method definition to return the doubled count.
<script setup> import { ref } from 'vue' const count = ref(0) function doubleCount() { return count.value [1] 2 } </script>
The method returns the count value multiplied by 2 using the * operator.
Fix the error in the computed property that should return count squared.
<script setup> import { computed, ref } from 'vue' const count = ref(3) const squared = computed(() => count.value [1] 2) </script>
The exponentiation operator ** raises count.value to the power of 2, correctly squaring it.
Fill both blanks to create a method that returns the count doubled and a computed property that returns count tripled.
<script setup> import { ref, computed } from 'vue' const count = ref(1) function double() { return count.value [1] 2 } const tripled = computed(() => count.value [2] 3) </script>
Both the method and computed property multiply count.value by a number using the * operator.
Fill all three blanks to create a computed property that filters even numbers and a method that sums an array.
<script setup> import { ref, computed } from 'vue' const numbers = ref([1, 2, 3, 4, 5]) const evens = computed(() => numbers.value.filter(n => n [1] 2 === 0)) function sum() { return numbers.value.reduce((acc, n) => acc [2] n, [3]) } </script>
The computed property filters numbers where the remainder when divided by 2 is 0 (even numbers). The method sums all numbers starting from 0 using the + operator.