如何检查对象在JavaScript中是否具有键?[重复]

正确的做法是?

if (myObj['key'] == undefined)

要么

if (myObj['key'] == null)

要么

if (myObj['key'])