Determine If an Object Has a Property
You can check to see if an object has a property using the in expression.
<!DOCTYPE HTML>
<html>
<head>
<title>Example</title>
</head>
<body>
<script type="text/javascript">
var myData = {
name : "JavaScript",
weather : "Good",
};
var hasName = "name" in myData;
var hasDate = "date" in myData;
var hasWeather = "weather" in myData;
document.writeln("HasName: " + hasName);
document.writeln("HasDate: " + hasDate);
document.writeln("HasWeahter: " + hasWeather);
</script>
</body>
</html>