I am defining my variable as array and pushing values inside it. When I try to access this variable inside another method and apply push function on it, It says, Push is not defined. When I check the typeof of this variable it shows as String.
Any suggestions?
recipients = [];
....
handleEmailChange(event) {
const {name , value , dataset: {recipientIndex} } = event.target;
this.toAddresses[recipientIndex][name] = value;
}
handleChange(event) {
this.recipients = event.detail.value;
}
handleSend(event){
this.toAddresses.forEach ( (address) => {
const email = address.emailAddress;
this.recipients.push(email); // ERRORS OUT
event.detail.valueinhandleChangemethod is a string.