I have an object named: mapped_errors that returns a dynamic object.
sometimes its value is:
{ _id:
{ location: 'body',
param: '_id',
value: 123,
msg: '_id is required and must be a string' } }
and sometimes its value is:
{ _name:
{ location: 'body',
param: '_name',
value: 123,
msg: '_name is required and must be a string' } }
and i want to output the msg value something like this:
let obj_key = Object.keys(mapped_errors);
console.log(mapped_errors.{obj_key}.msg); // i know this is wrong
;-)