I'm wondering if I am doing this in the most efficient way.
So I'm declaring my function el
which is equal to a macro (Google Tag Manager), then I reassign or overwrite that previously-defined var which grabs the innerText/textContent of the element. It then converts the string to lowerCase and then capitalizes the first letter of the string, before finally returning the 'cleaned-up' element.
function() {
var el = {{element}}
el = (el.innerText || el.textContent);
el = el.toLowerCase();
el = el.charAt(0).toUpperCase() + el.slice(1);
return el;
}