javascript check nested property exists