E.g. give names to layers. And then search layers by names.

```
var layer = new ol.layer.TileLayer({
  name: 'my layer'
  ...
});
map.addLayer(layer);
```

and then:

```
var layers = map.getLayers().getArray();
var myLayer = jQuery.grep(layers, function(layer, i) { return layer.get('name') === 'my layer'; })[0];
```