Lets say you have javascript object like here:
{
"1": "koko",
"2": "shoko"
}
And you need to remove only one property from it, say only the first one, which key is "1".Yes, you can do it using old good "delete" command, but instead i recommend to take advantage of "ES6 destuctors" and spread
Destructors are way to set variables from existing object in one single command.
Spread command is for splitting the object (or array) properties to different variables.
By combining those to ES6 features we can do the trick: Which is much more nice
No comments:
Post a Comment