I am trying to append some data into an array that will be used to send a triggered email. All code working fine except the push().
let toInsert = {
"Firstname": firstname,
"Lastname": lastname,
"Email": email,
"Phone": phone
}
I want to add an additional line (“ParentName”: parent) to the toInsert array and have tried several ways using push(), but each time I get an error: “toInsert.push is not a function.”
Attempt 1:
toInsert.push({"ParentName" : parent});
Attempt 2:
let obj = {}
obj["ParentName"] = parent;
toInsert.push(obj);
Attempt 3:
let obj=
{"ParentName": parent}
toInsert.push(obj);
Running out of ideas on how to do this.