Complete the code to define a computed property that returns the reversed message.
<script setup> import { ref, computed } from 'vue' const message = ref('hello') const reversedMessage = computed(() => [1]) </script>
The computed property must access the reactive value with .value and then reverse the string.
Complete the code to create a computed property that returns the full name by combining firstName and lastName.
<script setup> import { ref, computed } from 'vue' const firstName = ref('John') const lastName = ref('Doe') const fullName = computed(() => [1]) </script>
Access the values of both refs and join them with a space to form the full name.
Fix the error in the computed property that should return the uppercase version of the input text.
<script setup> import { ref, computed } from 'vue' const inputText = ref('vue') const upperText = computed(() => [1]) </script>
You must use .value to access the string inside the ref and then call toUpperCase() on it.
Fill in the blank to create a computed property that returns the number of vowels in the message.
<script setup> import { ref, computed } from 'vue' const message = ref('hello world') const vowelCount = computed(() => { return message.value.split('').filter(char => 'aeiou' [1] char).length }) </script>
The includes method checks if the character is one of the vowels.
Fill all three blanks to create a computed property that returns an object mapping each word to its length, but only for words longer than 3 characters.
<script setup> import { ref, computed } from 'vue' const sentence = ref('Learn Vue with fun exercises') const wordLengths = computed(() => { return sentence.value.split(' ').reduce((acc, [1]) => { if ([2].length > 3) { acc[[3]] = [2].length } return acc }, {}) }) </script>
Use the variable word consistently to represent each word in the array.