किसी ऑब्जेक्ट की प्रॉपर्टी एक्सेस करना
वस्तुओं के बिना कोई जावास्क्रिप्ट नहीं है। सब कुछ जैसे बूलियन, नंबर, फंक्शन आदि सभी ऑब्जेक्ट हैं। किसी ऑब्जेक्ट के एक्सेसिंग गुणों को निम्नलिखित विधि में समझाया गया है।
उदाहरण-1
<html>
<body>
<script>
myObj = {"name":"Ramesh","age":30,"family":
[{"mother":"Geetha","father":"Rao"}],"city":"Berlin"};
var res = myObj.family[0].mother;
document.write(res);
</script>
</body>
</html> आउटपुट
Geetha
उदाहरण-2
<html>
<body>
<script>
myObj = {"name":"Ramesh","age":30,"family":
[{"mother":"Geetha","father":"Rao"}],"city":"Berlin"};
var res = myObj.city;
document.write(res);
</script>
</body>
</html> आउटपुट
Berlin