I need to create a new array of objects from the existing array on vuejs.
example first array :
import { ref } from 'vue';
const base_array = ref([
{id: 1, name: Pill, timing: [morning, noon, evening, night]},
{id: 2, name: Tablet, timing: [morning, evening]},
])
expected result :
const modified_array = ref([
{id: 1, name: Pill, timing: [morning]},
{id: 2, name: Pill, timing: [noon]},
{id: 3, name: Pill, timing: [evening]},
{id: 4, name: Pill, timing: [night]},
{id: 5, name: Tablet, timing: [morning]},
{id: 6, name: Tablet, timing: [evening]},
])
I've tried forEach and looping the array, but seems can't find the right function. Thank youu
modified_arrayto change whenbase_arraychanges?