I'm using Vue.js and I came across the title error.
I have an array object:
students[
contact: {
mobile: null,
phone: null
}
],
The contact
array is not always populated.
How do I not give TypeError: Cannot read property 'phone' of undefined
when the array has not been created?
I tried to add in more also did not give:
mounted () {
this.students.contact.fone = ''},