1
In javascript I have an array "cardsUsuario" and I need to create a newArray only with the values of . text that will enter in the cardUsuario. At some point I need to give a . push and it will be added at the end of the cartsUsuario array an object in this model {text: "A ", value: 11}.
let cartasUsuario = []
let novoArray = []
(3) [{…}, {…}, {…}]
0: {texto: "A♠️", valor: 11}
1: {texto: "2♥️", valor: 2}
2: {texto: "3♥️", valor: 3}
What I need to do to create another array with the concatenated content I receive from . text?
console.log(`${cartasUsuario[0].texto + cartasUsuario[1].texto + cartasUsuario[2].texto} = pontuação ${usuarioValor}`)
I could use Swahili[0]. text, lettersUsuario[1]. text etc but it would look great when more cards come in. I wanted something that would solve this in a more practical way.
I really don’t understand very well what you’re trying to do... You want to concatenate all the properties
texto
of the array objectscartasUsuario
or add the property numbersvalor
? Try [Edit] your question to make it a little clearer. :-)– Luiz Felipe
You want to create a new array only with text atrubuto?
– Ewerton Belo
I tried editing, but that’s right. I need to concatenate all the text properties of the objects in the Sway array.
– Vitorslopes