A property can be unpacked from an object and assigned to a variable with a different name than the object property.
response1 = { data : { username : 'john' }, status: '200' }; response2 = { data : { obj : { product : "Car" } }, status: '404' } const { data } = response1; const { data : obj } = response2; console.log(data); console.log(JSON.stringify(obj));
Destructuring same key name