1

Is there a way to append data to a 3D array with arrayAppend? I am trying to create a shopping cart and I need to add each item with quantity, price, and shipping location together

1 Answer 1

2

3D array? It may be easier to have an array of struct's.

cart = [
  {
    qty: 2,
    price: 3.99,
    shippingLocation: "somewhere"
  }
];

arrayAppend(cart, {
    qty: 3,
    price: 19.99,
    shippingLocation: "somewhere else"
});
Sign up to request clarification or add additional context in comments.

3 Comments

arrayAppend(), Henry, not structAppend().
@Geo, if you find an error with this, follow Adam's advice, Henry made an easy mistake, with a very easy fix.
@cfqueryparam thanks. I figured as much when I started working on it. Thanks to Adam as well

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.