Skip to content

Instantly share code, notes, and snippets.

@alangabrielbs
Created July 31, 2021 17:38
Show Gist options
  • Save alangabrielbs/2c8cbaaf9ac05565047cf2562477558f to your computer and use it in GitHub Desktop.
Save alangabrielbs/2c8cbaaf9ac05565047cf2562477558f to your computer and use it in GitHub Desktop.
testando conhecimento
// Converta o array "wrongDataFormat" para o objeto do comentário abaixo.
const wrongDataFormat = [
'preto-PP',
'preto-M',
'preto-G',
'preto-GG',
'preto-GG',
'branco-PP',
'branco-G',
'vermelho-M',
'azul-XG',
'azul-XG',
'azul-XG',
'azul-P'
]
/*
{
preto: {
PP: 1,
M: 1,
G: 1,
GG: 2
},
branco: {
PP: 1,
G: 1
},
vermelho: {
M: 1
},
azul: {
XG: 3,
P: 1
}
}
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment