Skip to content
Advertisement

Clear each value of each key inside an object

I don’t figure it out, how to clear each value of each key inside an object.

The result should be like this.

JavaScript

I’m using Typescript.

Thank you for your help.

Advertisement

Answer

Map the keys to an array of [key, ""] and then convert to an object using Object.fromEntries():

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement