How to split like "value in array"

I'n trying to separate one flow depending if one property is included in a set of values or in other. By now it only has two options (two different sets) but today may have more.
I'm trying to acomplish this in a function node. I would prefer it in a split module for optimization, but still don't have the skills.
Anyways none of the JS methods I know work there. This is the function:

const sensors = [1,4,5,6,7,8,9,10,11];
const actuators = [2,3];

//if (sensors.includes({msg.subType})){ // Doesn't work.
if ($.inArray({msg.subType},sensors) > -1) // Also doesn't work
    return msg, null;
else if ($.inArray({msg.subType},actuators) > -1) // Also doesn't work
    return null, msg;
    
return null,null;

I would thank some help from a more experienced node-red user.

Show us the actual data. Put a debug node on the output of what ever is feeding your function node and change the debug node to display the complete msg object

That is a jQuery function that isn't needed in modern javascript. Nor is it available in the node.js runtime environment.

Assuming you want to check if the value of msg.subType appears in the sensors and actuators arrays, you can do:

const sensors = [1,4,5,6,7,8,9,10,11];
const actuators = [2,3];

if (sensors.indexOf(msg.subType) > -1)
    return [msg, null];
else if (actuators.indexOf(msg.subType) > -1)
    return [null, msg];

return;

For reference, see MDN's docs on Array.indexof.

That's it! Thanks @knolleary.
Do you think it would be possible by only using switch nodes?