Adding multiple items of different categories to one object I want to run the function addItem() for every item. Multiple items will belong to the same slot (category). For each category I have to run the function with the same slot. I don't want to manually write down the slot for each and every item, because there could be 100's for each category.

The goal is to get the best result in terms of: readability, maintainability and effort to add items.

Here is my current code:

let equipment = {
    head: {},
    cape: {},
    neck: {},
    ammunition: {},
    weapon: {},
    body: {},
    shield: {},
    legs: {},
    hand: {},
    feet: {},
    ring: {}
};

function createShortName(name) {
    return name.toLowerCase().replace(/\s/g, '');
}

function addItem(slot, name, cost, img, income=0, atk_bonus=0, str_bonus=0, def_bonus=0, rngd_bonus=0, mage_bonus=0) {

    let newItem = {
        slot: slot,
        name: name,
        cost: cost,
        img: img,
        income: income,
        atk_bonus: atk_bonus,
        str_bonus: str_bonus,
        def_bonus: def_bonus,
        rngd_bonus: rngd_bonus,
        mage_bonus: mage_bonus
    }

    equipment[slot][createShortName(name)] = newItem;
}

let currentSlot = 'head';
addItem(currentSlot, 'head_item_1', 100, 'img');
addItem(currentSlot, 'head_item_2', 200, 'img');

currentSlot = 'cape';
addItem(currentSlot, 'cape_item_1', 100, 'img');

currentSlot = 'neck';
addItem(currentSlot, 'neck_item_1', 100, 'img');
addItem(currentSlot, 'neck_item_2', 200, 'img');
addItem(currentSlot, 'neck_item_3', 400, 'img');
addItem(currentSlot, 'neck_item_4', 800, 'img');

// etc. etc. etc.


As you can see, I add items to the equipment object at the bottom of the code. Is there a better approach?
With regards to the last couple of lines, one thing you could do from a functional perspective is to bind the first argument like so:

function bindFirst(func, firstArgument) {
    return function(...arguments) {
        return func(firstArgument, ...arguments);
    }
}

const addToHead = bindFirst(addItem, 'head');

addToHead('head_item_1', 100, 'img');
...


You could also use data structure like a Map and loop through it:

let newItems = new Map([
    [
        'head',
        [{
            name: 'head_item_1',
            cost: 100,
            img: 'img'
        },
        {
            name: 'head_item_1',
            cost: 100,
            img: 'img'
        }]
    ], [
        'cape',
        [{
            name: 'cape_item_1',
            cost: 100,
            img: 'img'
        },
        {
            name: 'cape_item_1',
            cost: 200,
            img: 'img'
        }]
    ]
]);

items.forEach((items, slot) =&gt; {
    const addToSlot = bindFirst(addItem, slot);
    items.forEach(item =&gt; {
        addToSlot(item.name, item.cost, item.img);
    });
});


Have you considered that maybe equipment and item should be classes? A class called Equipment could have a method like addItem(slot, item) where item is an object of type Item, which has a constructor with a similar signature to your addItem function.