How do I set a default value to a variable if array.find returns 'undefined'.
Here's the line that's causing me issues. In some instances this variable will populate but in others, it won't and in that case, I want it to default to 0.
this.statistics.creditAmount = response.data.find(t => t.paymentType == 'RF' && t.status == 1).amount || 0;