I'm getting data for a single field in a table and I'd like to format the string with HTML. I'm getting an error that my JS syntax is incorrect but I think it looks ok.
{{
var HTMLtext = '';
var contacts = 'test@test.com Test 1, test2@test.com test 2';
var contactsArray = contacts.split(',');
contactsArray.forEach(convertMailTo);
return HTMLtext;
function convertMailTo(items, index) {
const contactArray = items.split(' ');
HTMLtext += index + ': <a href=mailto:' + contactArray[0] + '>'+ contactArray[1] + ' '+ contactArray[2] +'
';
}
}}
What am I doing wrong?