How to setProperties only on certain instances in a set?

I’m doing a Instances.forEach((i) => { i.setProperties({"signal": "red"}) }) but the problem is not all is not all instances in Instances has the property signal, so when it encounters such an instance, it breaks with an error like blah blah does not exist.

How to I do a if (i.propertyExists("signal") { i.setProperties({"signal": "red"}) }?