Error google tag manager?

In google tag manager when you insert javascript code in their example
function()
{
var dSelector = '[name=your-sex]';
var dOptions = document.querySelectorAll(dSelector+' option');
for(var i = 0; i < dOptions.length; i++)
if(dOptions[i].selected)
return dOptions[i].innerHTML;
}

Get "Error in line 6, character 38. Parse error. ')' expected"
can not understand what not so made (
June 14th 19 at 20:33

Find more questions by tags GoogleJavaScript