I would like to push to a single object similar to the following code
error = [];
error.push({name: 'Name is too short'});
error.push({email: 'Email address is too short'});
The problem with this is that it makes multiple objects and I wish to only create one.
Can you tell me the best way to do this or point me in the right direction, thank you.