객체의 속성 액세스
객체가 없으면 JavaScript도 없습니다. boolean, 숫자, 함수 등 모든 것이 객체입니다. 객체의 속성에 접근하는 방법은 다음과 같습니다.
예시-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