Kuis Computed Properties — Vue

Kuis materi Computed Properties di Vue — uji pemahamanmu dengan pertanyaan pilihan ganda, penjelasan jawaban, dan skor langsung. Main gratis di Hyper Sheets.

Pertanyaan di kuis ini

  1. Lengkapi agar namaKapital dihitung ulang otomatis setiap kali nama berubah:
    import { ref, ___ } from 'vue'
    const nama = ref("budi")
    const namaKapital = ___(() => nama.value.toUpperCase())
  2. Lengkapi computed property:
    import { ref, ___ } from 'vue'
    const nama = ref("budi")
    const namaKapital = ___(() => nama.value.toUpperCase())
  3. Apa keunggulan utama computed dibanding fungsi biasa di Vue?
  4. Apa yang salah?
    const total = computed(() => { items.value.reduce((a, b) => a + b, 0) })