OK, it looks like I had the right answer unless if you don't want inherited properties:
if (x.hasOwnProperty('key'))
Here are some other options to include inherited properties:
if (x.key) // quickQuick and dirty, but it does the same thing as below.
if (x.key !== undefined)