Say I have an array such as this in Javascript:
var cars = { vendor: [ { type: [ 'camry', 'etc' ] } ] }
In Javascript what command can I use to add an item to type... For example if I wanted to have a text box that a user can place text into and then hit a button that will add the item into the array. The item that would be added would need to be placed in with the same items as "camry" and "etc". Thanks!
Try something like
cars.vendor[0].type.push("foo");
Where "foo" is your data to add.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With