javascript function

Posted by PeEn
2019. 11. 28. 11:47 Programing/Web Programming
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
</head>
<body>

	<script>
	function Human(strName, strAge,strJob){
		this.name = strName;
		this.age = strAge;
		this.job = strJob;
	}
	mHuman = new Human("홍길동",20,"프로그래머");

	document.write("이름 : "+mHuman.name+"<br>나이 : "+mHuman.age+"<br> 직업 : "+mHuman.job+"<br>");

	mHuman.tel = "010-123-1231";
	mHuman.showInfo = function(){
	alert("추가된 속성인 휴대폰번호는 "+this.tel+"입니다.");
	}
	mHuman.showInfo();
	document.write("휴대폰번호 : "+mHuman.tel);

	</script>


</body>
</html>