Here’s my draft.
First, you convert your array into a comma-delimited list by using a joined list column, with the delimiter being a single comma (no extra spaces).
Then, you add a JavaScript column and use this code.
function mode(array)
{
if(array.length == 0)
return null;
var modeMap = {};
var maxEl = array[0], maxCount = 1;
for(var i = 0; i < array.length; i++)
{
var el = array[i];
if(modeMap[el] == null)
modeMap[el] = 1;
else
modeMap[el]++;
if(modeMap[el] > maxCount)
{
maxEl = el;
maxCount = modeMap[el];
}
}
return maxEl;
}
let arr = p1.split(",");
return mode(arr)
Adapted from:

