Arrays in Vue

Displaying array contents in Vue is done the same way as in pure JavaScript. Let's see how it's done. Let's say in data we have a property arr that contains some array inside:

javascriptdata() {
  return {
    arr: [1, 2, 3],
  }
}

Let's print the elements of this array:

App.vue<template>
  {{ arr[0] }}
  {{ arr[1] }}
  {{ arr[2] }}
</template>
Задание 1

Let data store the following array:

javascriptdata() {
  return {
    arr: ['x', 'y', 'z'],
  }
}

Print each element of this array in a separate paragraph.

Задание 2

Let data store the following array:

javascriptdata() {
  return {
    arr: [1, 2, 3],
  }
}

Display the sum of the elements of this array.