How to delete property from spread operator? How to delete property from spread operator? arrays arrays

How to delete property from spread operator?


You could use Rest syntax in Object Destructuring to get all the properties except drugName to a rest variable like this:

const transformedResponse = [{    drugName: 'HYDROCODONE-HOMATROPINE MBR',    drugStrength: '5MG-1.5MG',    drugForm: 'TABLET',    brand: false},{    drugName: 'HYDROCODONE ABC',    drugStrength: '10MG',    drugForm: 'SYRUP',    brand: true}]const output = transformedResponse.map(({ drugName, ...rest }) => rest)console.log(output)