This whole condition could be avoided by adding the property to the object declaration.