Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is an object in JavaScript and access any property ?**
Accessing Property Of An Object
Without objects there is no JavaScript. Everything such as boolean,numbers,functions etc are all objects.Accessing properties of an object is explained in the following method.
Example-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>
Output
Geetha
Example-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>
Output
Berlin
Advertisements