const auto = {
marca: "Ford",
modelo: 1967,
interiores: []
}
const int = [
"Piel",
"Tapiceria color Vino",
"Tapetes"
]
auto.interiores.push(int)
console.log( auto )
The returned result is:
{
marca: 'Ford',
modelo: 1967,
interiores: [ [ 'Piel', 'Tapiceria color Vino', 'Tapetes' ] ]
}
The required result is without the double brackets:
{
marca: 'Ford',
modelo: 1967,
interiores: [ 'Piel', 'Tapiceria color Vino', 'Tapetes' ]
}
The push method accepts individual elements. So any parameter you specify will be treated as an element no matter what type it is (including arrays).
To indicate that the elements of the array should be added one by one, use the Spread Operator.
Changing:
By:
As you indicate in your expected result, it seems that you just want to assign that array to that object property, and you can do that like this:
I leave you an example snippet:
Depending on how you acquire the data to be entered, you can use the destructuring syntax and assign the value to the object using variables.
Example ES6