JavaScript function for to find a defined element within a nested array
Your function is fine for me according to the structure you mentioned. But it's slow because it has to run a full search every time it's called. The main reason is the structure. So I would suggest that build an index which will help you to search quicker.

Building an index

An index is simply a map associating each id to the corresponding Part. You will only need to fill it once then use it to access Parts by id more quickly.

var index = {};
fillIndexFrom(index, structure);

function buildIndexFrom (index, list) {
    list.forEach(function(part) {
        index[part.id] = part;
        if (part.subParts)
            fillIndexFrom(index, part.subParts);
    });
}

// Then to get the part of id 4 for example you simply do
var part = index[4];


Complexity comparison

If we assume that there are N parts and that you will do M searches then:


Your initial solution will cost O(M*N) (every search costs O(N) in worst case)
The index solution will cost O(N) + M * O(logN) (O(N) to fill the index and then O(logN) for every search)