Skip to content

Instantly share code, notes, and snippets.

@franciscojsc
Created April 3, 2022 21:41
Show Gist options
  • Select an option

  • Save franciscojsc/2f705f05dfcf7fd0340e791bc4988d07 to your computer and use it in GitHub Desktop.

Select an option

Save franciscojsc/2f705f05dfcf7fd0340e791bc4988d07 to your computer and use it in GitHub Desktop.
Exemplo de uso do 'Object.keys'
const form = {
name: { value: 'Francisco Chaves' },
email: { value: 'contato@franciscochaves.com' },
github: { value: 'https://github.com/franciscochaves' },
site: { value: 'https://franciscochaves.com.br' },
bio: { value: 'Software Engineer' },
avatar: { value: 'https://avatars.githubusercontent.com/u/13373569' },
};
const result = Object.keys(form).reduce((acc, key) => {
acc[key] = form[key].value;
return acc;
}, {});
console.log(result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment