I am not experienced with javascript and sometimes it pulls out weird issues like this that I can't figure out even if I find on google solutions for what I want to do.
Doing this console logs:
console.log(this.data.proSkills);
console.log(this.data['proSkills']);
This is the result:
{id: "xhg6jdfKRdjl1OHGIqwT", proSkills: Array(2)}
{id: "xhg6jdfKRdjl1OHGIqwT", proSkills: Array(2)}
Intellisense is giving me extentions methods/properties like forEach and length but they are all undefined.
console.log(this.data['proSkills'].length);
this.data.proSkills.forEach(f => {
console.log(f);
})
Result:
undefined
[sm]:1 ERROR TypeError: this.data.proSkills.forEach is not a function
This is how the full object looks like:
{id: "xhg6jdfKRdjl1OHGIqwT", proSkills: Array(2)}
id: "xhg6jdfKRdjl1OHGIqwT"
proSkills: Array(2)
0:
name: "ffffff"
__proto__: Object
...
I am trying to update an array to firebase, if length is greater than 0 then populate the reactive form with the array and update if length is 0 then just add values, this is all I want to do but I can't access the inside array since length is undefined and I can't even get to print the array in the console because it shows the whole object anyways.
console.log()the contents?