I have two objects like this
let a = { pending: '500', answer: '200', reject: '400' }
let b ={ Pending: 'pending', Answer: 'answer', Reject: 'reject' }
and now I want loop in the objects for this like:
const C = [{status:200,title:"answer"},{status:400,title:"reject"}, {status:500,title:"pendeing"}]
i can do it?? how
bbeing used here? Can't you obtain your output using justa?Object.entries(a).map( ([status, title]) => ({status, title}) )[{status: "pending", title: "500"}, ...]futhermore the statuscode is a string instead of a number ...