I need to return a value from my function where I'm using 2 for loop and if statement

```
function getTextColor(context) {
  var selection = context.selection;
  for(var i = 0; i < selection.count(); i++){
    var layer = selection[i];
    const attr = layer.CSSAttributes()
    const regex = /#\w{6}/
    for (let i = 0; i < attr.length; i++){
      let color = attr[i].match(regex)
      if (color)
        return color[0]   // I need to return this value from my function

    }

  }

}

```