# How to add custom functions to toolbox arrays

**URL:** https://forum.makecode.com/t/how-to-add-custom-functions-to-toolbox-arrays/43939
**Category:** PXT
**Created:** [May 11, 2026, 2:50pm UTC](https://forum.makecode.com/t/how-to-add-custom-functions-to-toolbox-arrays/43939 "2026-05-11T14:50:10Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![THEb0nny](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/theb0nny/32/3500_2.png) [@THEb0nny](https://forum.makecode.com/u/THEb0nny)
#### Post date: [May 11, 2026, 2:50pm UTC](https://forum.makecode.com/t/how-to-add-custom-functions-to-toolbox-arrays/43939/1 "2026-05-11T14:50:10Z")

</div>

How can I add my functions to the arrays namespace?  
I created functions in an extension and placed them in the arrays namespace. But they don’t show up in the toolbox’s arrays section. I tried placing them in subcategory, but nothing happens. Is there a way to solve this?

namespace arrays {

```auto
/**

```

```
 \* Поиск наиболее часто встречающегося числа в массиве - мода.

 \* Если массив был пустым, то вернёт null.

 \* @param numbers массив с числами

 \*/

//% blockId="Mode"

//% block="mode of $numbers array"

//% weight="89"

//% blockNamespace="custom"

//% subcategory="Ext"

//% group="Statistics"

export function mode(numbers: number\[\]): number {

    if (numbers.length === 0) return null;

    numbers.sort((a, b) => a - b);

    let maxCount = 0, currentCount = 1;

    let currentNum = numbers\[0\], mostFrequentNum = numbers\[0\];

    for (let i = 1; i < numbers.length; i++) {

        if (numbers\[i\] === currentNum) currentCount++;

        else {

            if (currentCount > maxCount) {

                maxCount = currentCount;

                mostFrequentNum = currentNum;

            }

            currentNum = numbers\[i\];

            currentCount = 1;

        }

    }

    if (currentCount > maxCount) mostFrequentNum = currentNum;

    return mostFrequentNum;

}

```

}

---

<div class="post-metadata">

### Author: ![NeverStopTheCoder](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/neverstopthecoder/32/21194_2.png) [@NeverStopTheCoder](https://forum.makecode.com/u/NeverStopTheCoder)
#### Post date: [May 12, 2026, 3:38am UTC](https://forum.makecode.com/t/how-to-add-custom-functions-to-toolbox-arrays/43939/2 "2026-05-12T03:38:49Z")

</div>

for a custom extension you just I think have to have the namespace be the exact same name maybe its Arrays,array,Array,Arrays so just figure out which one name your namespace that and it should work

---

<div class="post-metadata">

### Author: ![THEb0nny](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/theb0nny/32/3500_2.png) [@THEb0nny](https://forum.makecode.com/u/THEb0nny)
#### Post date: [May 12, 2026, 5:37pm UTC](https://forum.makecode.com/t/how-to-add-custom-functions-to-toolbox-arrays/43939/3 "2026-05-12T17:37:46Z")

</div>

I’ve already tried all of this. I could access my functions using the specified namespace in the JS code. But it still doesn’t show up in the standard arrays category in the toolbox.
