I've recently received a code stub for an inventory object as part of my JavaScript module assignment. The task is to expand on it to create an inventory with methods for adding and removing items from an items array. I'm finding it challenging to understand how to complete these methods and was hoping someone could guide me in the right direction.
The provided code stub is:
var inventory = {
items: [],
add: function(item) {},
remove: function(index) {}
};
After doing some research, I believe the appropriate methods to use are:
items.push("")
items.splice("")
However, I'm uncertain about where and how to incorporate them into the existing code stub.
Any assistance would be greatly appreciated!