DevTips Daily: Remove a property from an object in JavaScript

preview_player
Показать описание
⭐️ Check out more DevTips Daily ⭐️

#devtipsdaily Channel Handle @codebubb
Рекомендации по теме
Комментарии
Автор

First of all thanks for the video, super simple explanation, thanks to you I understood it perfectly !
I just wanted to ask you, Say we want to remove the code property inside the region,

the address object's properties are: address = { region : { code: 123 }, some more properties }
And I want to remove the code property inside of region

How would that be written ? (using the second method you have showed at 1:45)

I thought it would be written like this:
let { region.code, ...addressWithoutRegionsCode } = address;
But my compiler just won't accept it

What is the correct way ? @codebubb

liorkeren