To add items to an object with JavaScript, we assign the value to a property.
For instance, we write
const sendData = { field1: value1, field2: value2 };
sendData.field3 = value3;
to define the sendData
object.
And then we set the field3
property to value3
.