Need Help with JavaScript Problem

Good day all.
I need help with JavaScript (I did study it back in University over a decade ago).
I’m currently refreshing myself on the JavaScript syntax so everything’s coming back to me slowly.
The thing is I have a problem and the scope is beyond my capabilities. While i don’t have any reference code to post here, I would like assistance in how to approach my problem and solve it.
My problem:
I can declare 5 items types and their quantity will be 15 each.
Of the 5 item types the 5th declared item cannot be stored in the “Container” mentioned below.

I have 5 boxes - each box has 2 compartment and can store 5 of 1 item type and 3 of another item type. You can only store 2 different item types in each box.
eg. box1: item1 +5 and item 2 +3.

I have 1 container that can store 7 of 1 item type and 7 of another item type.
You can only store 2 different item types in this container.

I have 2 Special Containers.
Special Container 1 can store 12 of 1 item type.
Special Container 2 can store 9 of 1 item type.
Both Special Containers cannot store the same item type.

With the mentioned items above i want to be able to:
Declare the 5 item types.
eg. item1: Orange
item2: Apple, etc.

I want to be able to select which box/ container/ special container, that i can place the items in.
I may only select for example 1 or 2 boxes, the rest of boxes or containers I don’t select can then be filled in automatically with the declared items/ quantities.
eg.
box1: Orange +5, Apple +3
box2: Apple +5, Orange +3
box3: automatically filled with remaining items. (+5, +3)
box4: automatically filled with remaining items. (+5, +3)
box5: automatically filled with remaining items. (+5, +3)
Container: automatically filled with remaining items. (+7, +7)
Special Container1: automatically filled with remaining items. (+12)
Special Container2: automatically filled with remaining items. (+9)

tldr:
I want to allocate 5 item types, each with a quantity of 15, to boxes/ containers of different storage capacities. This will be a calculator of sorts.

I’m not asking to be spoon fed code, i would like to solve the problem on my own(mostly).
I’m more interested in what specific areas of javascript i should focus my studies on to solve the problem. Also can anyone tell me how complex this problem is?

I’m sorry about the lengthy post and i do appreciate any assistance rendered in this thread.

Firstly, welcome to the forums.

While we are primarily here to help people with their Free Code Camp progress, we are open to people on other paths, too. Some of what you are asking is pretty trivial in the Free Code Camp context, so you might find that if you’re not getting the instruction and material you need in your current studies, the FCC curriculum will really help you get started. At a modest guess I’d say investing a 4-5 hours working through the curriculum here will really pay off. You can find the curriculum at https://www.freecodecamp.org/learn.

With your current questions, we don’t have enough context to know what you already know or don’t know, so it is impossible to guide you without just telling you the answer (which we won’t do).

It is pretty typical on here for people to share a codepen / repl.it / jsfiddle example of what they have tried so that anyone helping has more of an idea of what help is actually helpful.

Please provide some example of what you’ve tried and I’m sure you’ll get more help.

Happy coding :slight_smile:

ilenia thanks for the response, i will go through the curriculum and return here when i’m done.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.